Site logo

Archived topic

I want to Show All Meta in One Line

23 replies · Started by Ravi Saive on June 30, 2020

Viewing posts 16–24 of 24

I am using a child theme and I placed the code in the child theme functions.php file. I only updated the theme manually by deleting the old theme and uploading the new theme.

The child theme remains the same with all the custom CSS and PHP code..

It's quite tricky to figure this out w/o having access to the backend of the staging site as we're basically blind guessing what happened.

The 3.1 update didn't change anything related to the post-meta filters. You can actually check the github repository to confirm this -
https://github.com/tomusborne/generatepress/blob/adfe090929b0515cdf894f4c6b722cfe8c0790dc/inc/structure/post-meta.php#L362-L367
https://github.com/tomusborne/generatepress/blob/adfe090929b0515cdf894f4c6b722cfe8c0790dc/inc/structure/post-meta.php#L382-L389
where you can see that the filters are 100% intact.

I even tested the exact same code and it works on my end.

The only way we can accurately check and confirm things is if we can access the backend. Perhaps the child theme isn't activated?

Any chance you can provide us access to check?

The child theme is activated and working fine, the only problem is the comment counts showing on the home page of the staging site - https://ibb.co/R3RJf1m - which I don't want on the homepage...

I want comment counts to be shown on all post pages like in the screenshot shown here - https://ibb.co/478YXkb

You can access the staging site, information provided in the private section.

I want comment counts to be shown on all post pages like in the screenshot shown here – https://ibb.co/478YXkb

Oh if this is the case then we'll have to modify the generate_header_entry_meta_items and generate_footer_entry_meta_items filter snippet to only add the comment count on single post pages.

Example:

add_filter( 'generate_header_entry_meta_items', function( $items ) {
	if( is_single() ){ 
		return array(
			'author',
			'date',
			'categories',
			'comments-link',     
		);
	} else {
		return $items;
	}
} );

add_filter( 'generate_footer_entry_meta_items', function( $items ) {
	if( is_single() ){
		return array_diff( $items, [ 'categories', 'comments-link' ] );
	} else {
		return $items;	
	}
} );

This code basically sets the filter to display the category and comment count on the header entry meta only on single post pages. Else, it keeps the default of the theme.

I added the code but it is not working, the comment count not showing in the header entry meta on single post pages..

Thanks a ton, Elvin, the code is working fine now, I can see comment counts...:)

No problem. :D

This archived topic is closed to new replies.