• Resolved peterpilp

    (@peterpilp)


    Hi,

    I need to print my “Author”,”Date” and “categories” below the title exactly as attached.


    link to image

    Exact text should be as below

    By [Author] – [Date] in [Categories in Bold text]

    Appreciate if you can help me to get it done, I read other posts and couldn’t get it done myself,

    Note: I don’t need categories icon also

    Cheers.

    • This topic was modified 4 years, 11 months ago by peterpilp.
    • This topic was modified 4 years, 11 months ago by peterpilp.

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    As of right now this is quite complicated. However, we’ve simplified it a lot in GP 2.3 which is in public testing: https://generatepress.com/generatepress-2-3/

    If you’re willing to try that alpha version I can give you the necessary code?

    Let me know 🙂

    Thread Starter peterpilp

    (@peterpilp)

    Hi Tom,
    Thank you you for your reply,

    Yes I’m excited to check the Alpha version out.

    meanwhile can I get it done in simplified form as below?

    By [Author] – [Date] in [Categories] // no need to remove categories logo // no need to make the categories bold.

    • This reply was modified 4 years, 10 months ago by peterpilp.
    Theme Author Tom

    (@edge22)

    It’s very simple to do if you’ve installed 2.3. Can you confirm that you have it installed?

    Then you can do this:

    add_filter( 'generate_header_entry_meta_items', function() {
        return array(
            'author',
            'date',
            'categories',
        );
    } );

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

    Thread Starter peterpilp

    (@peterpilp)

    Hi Tom,
    One more question, this works like a charm,
    but the categories on the bottom still displays along with the icon.
    when I disable it in Layout->Blog->Display post categories, both the top categories label and bottom categories label disappears,

    how can i remove only the bottom details?

    Cheers

    Theme Author Tom

    (@edge22)

    Hi there,

    Try this:

    add_filter( 'generate_footer_entry_meta_items', function( $items ) {
        return array_diff( $items, [ 'categories' ] );
    } );

    Let me know 🙂

    Thread Starter peterpilp

    (@peterpilp)

    Hey Tom,
    this code doesn’t show categories at all,
    It doesn’t matter whether “Display post categories” enabled or not, it shows only date and user only…

    Theme Author Tom

    (@edge22)

    The filter above only targets the footer entry meta. This function is also necessary: https://wordpress.org/support/topic/print-author-date-categories-under-title/#post-11594164

    If you have both functions, it should work nicely.

    Let me know 🙂

    Thread Starter peterpilp

    (@peterpilp)

    Genius,
    It does the job well, Tom,
    Cheers.

    Theme Author Tom

    (@edge22)

    Glad I could help 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Print “Author” – Date – Categories under Title’ is closed to new replies.