Site logo

Archived topic

How to Show Category Name Above, Near to Author Name?

7 replies · Started by Sibi Paul on December 22, 2018

Viewing posts 1–8 of 8

Sir,

Please Check mY Site any posts...

Post Date & Author Name Showing Just After the Title...

But,

Category Shows, After Content ( Bottom )

I wish to show This Order.

Category - Date - Author

How, this Possible, Please Help.

Hi there,

Give this PHP snippet a shot:

add_filter( 'generate_post_date_output', function( $date ) {
  
  $categories_list = get_the_category_list( ', ' );

    if ( $categories_list ) {
        echo '<span class="categories">' . $categories_list . '</span>';
    }
  
  echo $date;
    
} );

Adding PHP: https://docs.generatepress.com/article/adding-php/

Let me know :)

I tried this php snippet but it does not work.

Category is still shown below the blog post.

Please check and advise.

Thank you

You can stop it from appearing below the post by turning it off in "Customize > Layout > Blog".

Does the code add the categories above the post for you?

Ok, yes, thank you

The Code is showing the categorie above the post, but only on the Blog Page as you can see here.

There is also a little margin on the left missing. It is too close to the date.

Any suggestion how I could solve this?

Also I would like to have the categorie above the the post in all single posts.

Great support from you guys. Thank you

I did not understand anything.

For This Simple Function, I need to add a PHP Plugin ?

Yes PHP snippet is required. You can use a child theme as well if you are already using one.

Might be best to open a new topic if you have more questions.

Thanks!

This archived topic is closed to new replies.