Site logo

Archived topic

comment count in meta

7 replies · Started by manaadiar on December 7, 2018

Viewing posts 1–8 of 8

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 :)

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;
	}
}

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;
	}
}

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..

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>';
    }
}

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

No problem :)

This archived topic is closed to new replies.