[Resolved] Custom post type template identical to blog layout + categories layout

Home Forums Support Custom post type template identical to blog layout + categories layout

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1396071
    adriendemonta

    Dear Team,

    I’m a total newbie with CPT and have created today my first one. I’m trying to build up a review site based on GP Prime template.

    I’ve used the plugin CPT UI and created the CPT “review” and the Taxonomy “ranking”. I would like everything to look exactly like the blog so I have copy-pasted into my GP child Theme both files (single.php and archive.php) that I’ve renamed:

    single-review.php
    archive-review.php

    However, I’m now facing two issues:

    1/ When I access to the post category “Top 20” (you can find it on my site main menu), the styling does not look like the category layout of my blog (https://www…./category/cbd-guides/) – two-column, etc…

    2/ When I access to both post and Top20 category, I still see all the categories of my blog. I’d like to only show the categories (taxonomies) of my CPT review.

    I would really appreciate a little help. Best, Adrien

    #1396137
    Tom
    Lead Developer
    Lead Developer
    #1396213
    adriendemonta

    Thank you, Tom! Unfortunately, I tried pasting this into my functions.php but it did not work:

    add_filter( ‘generate_blog_columns’,’tu_portfolio_columns’ );
    function tu_portfolio_columns( $columns ) {
    if ( is_post_type_archive( ‘portfolio’ ) ) {
    return true;
    }

    return $columns;
    }

    add_filter( ‘generate_entry_meta_post_types’, function( $types ) {
    $types[] = ‘my-post-type’;
    $types[] = ‘review’;

    return $types;
    } );

    add_filter( ‘generate_footer_meta_post_types’, function( $types ) {
    $types[] = ‘my-post-type’;
    $types[] = ‘review’;

    return $types;
    } );

    #1396233
    Leo
    Staff
    Customer Support

    Did you replace portfolio my-post-type and review with the name of the actual post types you’ve created?

    Those are just examples.

    #1396238
    adriendemonta

    Thanks a lot Leo! Following to your reply, I have replaced these 3 with my CPT which is “review” but it still does not work.

    add_filter( ‘generate_blog_columns’,’tu_portfolio_columns’ );
    function tu_portfolio_columns( $columns ) {
    if ( is_post_type_archive( ‘review’ ) ) {
    return true;
    }

    return $columns;
    }

    add_filter( ‘generate_entry_meta_post_types’, function( $types ) {
    $types[] = ‘review’;
    $types[] = ‘review’;

    return $types;
    } );

    add_filter( ‘generate_footer_meta_post_types’, function( $types ) {
    $types[] = ‘review’;
    $types[] = ‘review’;

    return $types;
    } );

    #1397413
    Tom
    Lead Developer
    Lead Developer

    Let’s try the columns one first.

    So it looks like the page you linked to is the ranking taxonomy page.

    add_filter( 'generate_blog_columns', function( $columns ) {
        if ( is_tax( 'ranking' ) ) {
            return true;
        }
    
        return $columns;
    } );

    Does that add the columns to it?

    #1397497
    adriendemonta

    Hello Tom. It worked perfectly!!! I would have never found how to code that. I spent like 3 hours on it. I’m so thankful and excited to read how I can achieve the next step.
    Thanks a lot. Adrien

    #1397930
    Tom
    Lead Developer
    Lead Developer

    Awesome, glad I could help! 🙂

    #1398502
    adriendemonta

    Dear tom, Can you help me for point 2)?

    #1399084
    David
    Staff
    Customer Support

    Hi there,

    the WP core widgets are not developer friendly, they sort of do one thing – you may want to look for advanced related posts and category widgets in the WP Repo.

    #1399096
    adriendemonta

    Dear David. Thank you so much. I’m now in touch with a dev who’s going to take over following all your good recommandations.
    Really appreciated your help there.
    Best, Adrien

    #1399294
    David
    Staff
    Customer Support

    Glad we could be of help

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