[Support request] How to Show Category Name Above, Near to Author Name?

Home Forums Support [Support request] How to Show Category Name Above, Near to Author Name?

Home Forums Support How to Show Category Name Above, Near to Author Name?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #763818
    Sibi Paul

    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.

    #763967
    Leo
    Staff
    Customer Support

    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 🙂

    #764074
    Karsten

    I tried this php snippet but it does not work.

    Category is still shown below the blog post.

    Please check and advise.

    Thank you

    #764277
    Tom
    Lead Developer
    Lead Developer

    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?

    #764304
    Karsten

    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

    #764354
    Leo
    Staff
    Customer Support

    Try this CSS for the spacing:

    span.categories {
        padding-right: 5px;
    }

    Is the post date enabled for single posts?
    https://docs.generatepress.com/article/blog-content-layout/#single

    #764860
    Sibi Paul

    I did not understand anything.

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

    #764872
    Leo
    Staff
    Customer Support

    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!

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