Get Categories next to the Date in the Front page ?

Home Forums Modern Get Categories next to the Date in the Front page ?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #9788

    SpecOp
    Member

    Get Categories next to the Date in the Front page ?

    Resolved

    Hey there! Have you noticed this support service is provided FREE of charge?
    If you like the speed and accuracy of resolutions, please consider supporting me with a small donation. Thank you

    Consider a donation →

    Hi,
    This actually concerning Modern theme.
    I give you a photo to help, but is there a way to get the Cartegorie next to the Date in Front page ?
    Thanks for your help.

    #9793

    Oliver Juhas
    Keymaster

    Hi,

    You need to do this via your child theme‘s functions.php file:

    function my_post_meta( $data ) {
     if ( ! is_single() ) {
      $data['meta'] = array( 'date', 'category', 'comments', 'likes' );
     }
     return $data;
    }
    add_filter( 'wmhook_wm_entry_bottom_meta', 'my_post_meta' );
    

    Regards,

    Oliver

    #9794

    SpecOp
    Member

    Yes ! Very good, and very fast answer !
    Millions Thanks from Paris : )
    Cheers !

    #21523

    Sharkster4000
    Participant

    Hi there,
    I’ve tried this solution as posted:

    function my_post_meta( $data ) {
     if ( ! is_single() ) {
      $data['meta'] = array( 'date', 'category', 'comments', 'likes' );
     }
     return $data;
    }
    add_filter( 'wmhook_wm_entry_bottom_meta', 'my_post_meta' );

    …but it still shows only the date when the post was published on the homepage under each single post.

    Do I HAVE TO use this with a child-theme? Because I put it in the main functions.php. Is that what causes the problem?

    #21525

    Oliver Juhas
    Keymaster

    Hi Sharkster4000,

    First of all, please note that the code is very old. The theme was recoded back in version 2.0.0 if I’m not mistaken.

    To add categories into post meta on non-singular pages, please copy the template-parts/meta/entry-meta-bottom.php file into your child theme keeping the folder structure, and edit the file by adding get_template_part( 'template-parts/meta/entry-meta-element', 'category' ); somewhere between lines #39 and #41.

    Please never edit the theme files itself as you will loose your modification once the theme is updated. Always use a child theme for custom theme modifications.

    Best regards,

    Oliver Juhas
    WebMan Design

    #21528

    Sharkster4000
    Participant

    Worked like a charm.
    Thank you for the detailed and easy to follow answer!

    Best regards,
    Martin

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.