[Resolved] My custom post is not displaying date, author navigation etc like normal posts

Home Forums Support [Resolved] My custom post is not displaying date, author navigation etc like normal posts

Home Forums Support My custom post is not displaying date, author navigation etc like normal posts

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #590115
    Pete

    date, author, categories, tags, navigation

    #590314
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    On your custom post type?

    This might help: https://generatepress.com/forums/topic/custom-post-template-editing/#post-523368

    Let me know πŸ™‚

    #590439
    Pete

    Correct

    #590460
    Pete

    Great, thanks that works. Is there anyway we can have CPTs displaying this as default rather than having to add this?

    Cheers
    Pete

    #590462
    Pete

    It isn’t showing the post date?

    #590515
    Tom
    Lead Developer
    Lead Developer

    You can do this:

    add_action( 'generate_after_entry_header', 'tu_cpt_top_meta' );
    function tu_cpt_top_meta() {
        if ( 'your-post-type' === get_post_type() ) : ?>
            <div class="entry-meta">
                <?php generate_posted_on(); ?>
            </div><!-- .entry-meta -->
        <?php endif;
    }

    There’s no way to do it without the code right now, but I’ll look into making it as simple as adding a filter.

    #590516
    Pete

    Yeah sorry I just realised the above code was for the footer not the header πŸ™‚

    #590518
    Tom
    Lead Developer
    Lead Developer

    Yea sorry about that – using both functions should handle the header and footer πŸ™‚

    #706229
    Satori

    Hi! I was looking for info on how to add meta to CPT’s. I read about the possible filter to allow this level of compatibility. Just want to know if this is going to happen or we still have to do it old-school.

    BTW can’t wait for the new GP 2.2 testing as I understand will bring more Gutenberg options.

    #706558
    Tom
    Lead Developer
    Lead Developer

    There’s a filter in GP 2.2 that will allow you to do this:

    add_filter( 'generate_entry_meta_post_types', function( $types ) {
        $types[] = 'my-post-type';
    
        return $types;
    } );
    
    add_filter( 'generate_footer_meta_post_types', function( $types ) {
        $types[] = 'my-post-type';
    
        return $types;
    } );

    2.2 is a huge update – it’s going to need all the beta testing it can get πŸ™‚

    #706626
    Satori

    Thank you so much for this Tom! GP is definitely the way to go to develop amazing WordPress sites. I’ll help in beta all I can, that’s for sure.

    #706806
    Tom
    Lead Developer
    Lead Developer

    Thank you! πŸ™‚

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