[Resolved] Layout for custom posts archive

Home Forums Support [Resolved] Layout for custom posts archive

Home Forums Support Layout for custom posts archive

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #313360
    Pablo Querol

    Hi again Tom!

    I’m trying to make a catalogue of products for a client, and I’m using a custom post for the products and custom taxonomies for product categories and product attributes. I want it to be super light-weight and that’s the reason I’m not using Woocommerce or other catalogue plugin.

    My question is if it’s possible to customize the custom taxonomies archive page with Generate Press like we do with the WordPress core posts. I tried and some of the options apply, and some don’t. I only want to set the columns, it would be super awesome!

    Thanks in advance!

    #313489
    Tom
    Lead Developer
    Lead Developer

    Hi Pablo,

    You can set the columns feature in your custom post type with a filter: https://docs.generatepress.com/article/using-columns-in-the-blog/#adding-columns-to-your-custom-post-type

    Are there any other options you’re trying to use that don’t apply?

    Let me know πŸ™‚

    #315474
    Pablo Querol

    Hi Tom,

    Thanks for your answer!

    I just realised it’s not on a custom post type I’d like to set the columns feature, but on a custom taxonomy (equivalent in default blog: tags).

    I’m wondering if then this is possible.

    The taxonomy ID is ‘alergens’ and I’ve tried:

    add_filter( 'generate_blog_columns','tu_alergens_columns' );
    function tu_alergens_columns( $columns )
    {
        if ( is_taxonomy_type_archive( 'alergens' ) ) :
            return true;
        endif;
    
        return $columns;
    }

    But this gives a fatal error “Fatal error: Uncaught Error: Call to undefined function is_taxonomy_type_archive() …”.

    add_filter( 'generate_blog_columns','tu_alergens_columns' );
    function tu_alergens_columns( $columns )
    {
        if ( is_product_type_archive( 'alergens' ) ) :
            return true;
        endif;
    
        return $columns;
    }

    Doesn’t work neither.

    Would appreciate any clue on this πŸ™‚

    #315511
    Tom
    Lead Developer
    Lead Developer

    This is the conditional you’re looking for I think: https://codex.wordpress.org/Function_Reference/is_tax

    #315512
    Pablo Querol

    You’re a superstar Tom, worked smoothly!

    #315526
    Tom
    Lead Developer
    Lead Developer

    Awesome! πŸ™‚

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