[Resolved] Entry Meta Items different for one categories single posts

Home Forums Support [Resolved] Entry Meta Items different for one categories single posts

Home Forums Support Entry Meta Items different for one categories single posts

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1168538
    webcréateur

    Hi there,

    We added following filter to output entry meta of single posts and archive view:

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

    This works fine so far!

    Now we want to output the meta “date” only for one categories (ID 4651) posts and archive.

    I tried something like this and set a higher priority to the snippet, but it won’t work:

    add_filter( 'generate_header_entry_meta_items', function() {
    	 if (is_single() && in_category('4651')) {
        return array(
            'categories',
    	'author',
            'date',
    		);
    		 }
    } );

    Any Ideas how to solve this?

    Best regards!

    #1168600
    David
    Staff
    Customer Support

    Hi there,

    try combining the function:

    add_filter( 'generate_header_entry_meta_items', function() {
        if (is_single() && in_category('4651')) {
            return array(
                'categories',
                'author',
                'date',
            );
        } else {
            return array(
                'categories',
                'author',
            );
        }
    } );
    #1168778
    webcréateur

    Thanks a lot, David. That worked great! 🙂

    #1168835
    David
    Staff
    Customer Support

    Glad to hear that

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