• Dear all,

    I have the following issues. Im not very familiar with the code, so after creating my CPT, I just copy archive.php and content.php to my child theme and rename them as archive-cpt_slug.php and content-cpt_slug.php.

    In general, the change works ok, I find titles, featured image, columns as designed on the designer blog.

    The only issues that I have is that I lost date, author of the entry under the title and comments link and counter at the end. Not sure how can I solve it… I’m not very familiar with the code.

    Can anybody help me?
    Thank you!!

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

    (@edge22)

    Hi there,

    Try this:

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

    Let me know ??

    Thread Starter maaper

    (@maaper)

    Ok ?? Tom I will try today,

    Just one additional question, that must be include on archive or content file?

    Thanks!

    Theme Author Tom

    (@edge22)

    It should be added using one of these methods: https://docs.generatepress.com/article/adding-php/

    Thread Starter maaper

    (@maaper)

    Thank you Tom,
    I include the code using Code Snippets. But after the activation of the snippet, I can’t see the elements (the than in archive happens inside the post page).

    This is a picture with the Blog archive on the left and CPT archive on the right.
    Example Post-vs-CPT-archive-GeneratePress

    Thanks again for your help and guiding.

    Regards.

    • This reply was modified 4 years, 11 months ago by maaper.
    Theme Author Tom

    (@edge22)

    Hi there,

    Are you sure the post type name you’ve added is the current name/slug of your custom post type?

    Any chance you can link me to that page?

    Thread Starter maaper

    (@maaper)

    Sure Tom,
    This is my web page: https://clubprueba5.server3.demoswp.com

    And the different post types:
    /noticias (blog default)
    /articulos (my cpt)

    Thanks again.

    • This reply was modified 4 years, 11 months ago by maaper.
    • This reply was modified 4 years, 11 months ago by maaper.
    Theme Author Tom

    (@edge22)

    So just to confirm, this is your code?:

    add_filter( 'generate_entry_meta_post_types', function( $types ) {
        $types[] = 'cnlb_articulos';
    
        return $types;
    } );
    
    add_filter( 'generate_footer_meta_post_types', function( $types ) {
        $types[] = 'cnlb_articulos';
    
        return $types;
    } );
    Thread Starter maaper

    (@maaper)

    Ahhh, just confirmed.
    I was using the slug name instead the cpt name!!
    Now I change as suggested and I get the information.
    Thank you!!

    One last question the blog definition in wp standard used to be in home.php
    When I change to Generatepress, it is using archive.php or content.php instead for the definition of the loop?

    Thanks a lot for your valuable support.

    • This reply was modified 4 years, 11 months ago by maaper.
    Theme Author Tom

    (@edge22)

    Your blog page should use index.php for the loop.

    Archives use archive.php.

    If you add home.php to your child theme, it will be used instead of index.php.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘content-cpt.php’ is closed to new replies.