Archived topic
Display categories on the top of the blogpost besides author name!
1 reply · Started by Lelin on October 29, 2022
Hi,
I was following this guide https://generatepress.com/forums/topic/display-categories-on-the-top-of-the-blogpost/ but not working for me.
Tried below code:
add_action( 'generate_after_entry_title', function() {
$cat = get_the_category();
if ( isset( $cat[0]->parent ) ) {
var_dump($cat[0]->parent);
echo '
';
}
} );
So is there any way to display categories on the top of the blogpost besides author name?
Hi there,
That post is outdated.
I believe is a block element post meta is what you are looking for:
https://docs.generatepress.com/article/block-element-post-meta-template/
Let me know if this helps :)