Archived topic
Layout for custom posts archive
5 replies · Started by Pablo Querol on May 3, 2017
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!
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 :)
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 :-)
This is the conditional you're looking for I think: https://codex.wordpress.org/Function_Reference/is_tax
You're a superstar Tom, worked smoothly!
Awesome! :)