[Resolved] comment count in meta

Home Forums Support [Resolved] comment count in meta

Home Forums Support comment count in meta

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #751209
    manaadiar

    Hi, I want the comment count to show in my single post like it shows in my content page.. Please see 1st screen shot which is the main page https://shippingandfreightresource.com/articles where I can see the comment count for the individual articles..

    with comments count

    But when I open any individual post, comment count is not there..

    without comment count on individual page

    Can you pls assist, thanks..

    Regards
    Manaadiar

    #751524
    Leo
    Staff
    Customer Support

    Hi there,

    Looks like you are currently using a special function to display the entry meta?

    If so can you copy and paste the function here?

    Make sure to highlight the code and click the code button above so it shows up correctly.

    Let me know ๐Ÿ™‚

    #751634
    manaadiar

    Hi Leo, below is what I am using the functions.php but that was only to bring the post meta to the top instead of the bottom where it was

    if ( ! function_exists( 'generate_post_meta' ) ) {
    	add_action( 'generate_after_entry_title', 'generate_post_meta' , 'generate_after_entry_content', 'generate_footer_meta' );
    	/**
    	 * Build the post meta.
    	 *
    	 * @since 1.3.29
    	 */
    	function generate_post_meta() {
    		if ( 'post' == get_post_type() ) : ?>
    			<div class="entry-meta">
    				<?php generate_posted_on(); ?>
    			
    				<?php
    				generate_entry_meta();
    
    				?>
    			Estimated reading time = <?php echo reading_time(); ?>	
    			
    				
    		<?php endif;
    	}
    }
    #751737
    Leo
    Staff
    Customer Support

    Can you try this:

    if ( ! function_exists( 'generate_post_meta' ) ) {
    	add_action( 'generate_after_entry_title', 'generate_post_meta' , 'generate_after_entry_content', 'generate_footer_meta' );
    	/**
    	 * Build the post meta.
    	 *
    	 * @since 1.3.29
    	 */
    	function generate_post_meta() {
    		if ( 'post' == get_post_type() ) : ?>
    			<div class="entry-meta">
    				<?php generate_posted_on(); ?>
    			
    				<?php
    				generate_entry_meta();
                                    if ( is_single() ) {
                                    echo '<span class="comments-link">';
    				    comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) );
    			        echo '</span>';
    				?>
    			Estimated reading time = <?php echo reading_time(); ?>	
    			
    				
    		<?php endif;
    	}
    }
    #752093
    manaadiar

    Hi Leo, there was a missing } (just before the estimated reading time), but after I added it, it works.. BUT only on SOME articles its not working.. If you click the first link it works, but it doesn’t work on the second link.. Not sure why.. Any ideas..??

    Works on

    https://shippingandfreightresource.com/demurrage-and-detention-exporter-vs-shipping-line/

    https://shippingandfreightresource.com/demurrage-detention-and-port-charges/

    Doesn’t work on

    https://shippingandfreightresource.com/will-the-container-industry-ever-forget-fob/

    https://shippingandfreightresource.com/difference-between-a-freight-forwarder-and-nvocc/

    Any suggestions as all are posts done the same way.. Puzzling..

    #752259
    Leo
    Staff
    Customer Support

    Can’t see any reason why it would only work in some posts.

    Can you try this filter instead?

    add_filter( 'generate_post_author_output','tu_no_author_link' );
    function tu_no_author_link( $output ) {
        echo $output;
    
        generate_entry_meta();
    		  
        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>';
        }
    }
    #752460
    manaadiar

    Hi Leo, I see now that the other posts are working and displaying fine without any change.. Thanks..

    #752983
    Leo
    Staff
    Customer Support

    No problem ๐Ÿ™‚

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.