[Support request] How to edit the meta (authorname, category, date etc) for posts?

Home Forums Support [Support request] How to edit the meta (authorname, category, date etc) for posts?

Home Forums Support How to edit the meta (authorname, category, date etc) for posts?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1535611
    Sascha

    Hi,

    I have created some CPT via “Pods” and now would like some of them displayed incl. their standard meta, others only “Date Modified”:

    CPT “academy”: no meta at all
    CPT “support”: Only “date modified”
    Blog Post Type: Only “date modified” & “category”

    on top of each post, and “category” & “tags” below each post for each CPT.

    I have seen this doc-page about “generate_entry_meta_post_types”, but not able to modify this in order to make it work here. is this the correct snippet anyway? If not, what’s that for?

    And how to accomplish the above mentioned requirements?

    Thank you and kind regards,
    Sascha

    #1536516
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    No meta at all should be the default for custom post types.

    To enable post meta on your support cpt, you can do this:

    add_filter( 'generate_entry_meta_post_types', function( $types ) {
        $types[] = 'support';
    
        return $types;
    } );

    Now we can tell the support cpt to only display the date:

    add_filter( 'generate_header_entry_meta_items', function( $items ) {
        if ( 'support' === get_post_type() ) {
            $items = array(
                'date',
            );
        }
    
        return $items;
    } );

    Let me know if this helps or not 🙂

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