[Resolved] Editing the entry meta output

Home Forums Support Editing the entry meta output

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1239705
    Brian

    Hi

    I need to edit my entry meta to move the comments link so that it sits on the end of the line.
    I’ve searched the forum and found some code for modifying the meta, and here’s what I’m using to edit it so far.

    The code snippet

    add_filter( ‘generate_post_date_output’, ‘lh_single_comments_link’ );
    function lh_single_comments_link( $date ) {

    echo $date;

    if ( is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
    echo ‘<span class=”comments-link”>’;
    comments_popup_link( __( ‘Leave a comment’, ‘generatepress’ ), __( ‘1 Comment’, ‘generatepress’ ), __( ‘% Comments’, ‘generatepress’ ) );
    echo ‘</span>’;
    }
    }

    And this CSS to show the comment link, plus change the post to ‘Last Updated:’

    .single .comments-link {
    display: inline-block;
    }

    .posted-on .updated {
    display: inline-block;
    }

    .posted-on .updated + .entry-date {
    display: none;
    }

    .posted-on .updated:before {
    content: “Last Updated: “;
    }

    #1240501
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Try this, instead:

    add_filter( 'generate_header_entry_meta_items', function( $items ) {
        $items[] = 'comments-link';
    
        return $items;
    } );

    Let me know 🙂

    #1240507
    Brian

    Still the same 🙁

    #1240665
    Brian

    Hi Tom,
    I changed the snippet to that code, but that it seems to eliminate the comment link altogether.

    #1240825
    Tom
    Lead Developer
    Lead Developer

    Is the comments count option enabled in Customize > Layout > Blog?

    #1241127
    Brian

    No, it wasn’t. I enabled it and the comment link now works now.
    I thought that was just to show the link on archives which I’m not sure I want, but I can live with.
    Thanks for the help Tom 🙂

    #1241782
    Tom
    Lead Developer
    Lead Developer

    You could try this:

    body:not(.single) .comments-link {
        display: none;
    }
    #1241839
    Brian

    Hey Tom
    That worked, thanks so much!

    #1242208
    Tom
    Lead Developer
    Lead Developer
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.