- This topic has 14 replies, 2 voices, and was last updated 1 year, 7 months ago by
David.
-
AuthorPosts
-
November 26, 2020 at 12:05 am #1548636
Alexandra
Hey guys!
I have a small issue with my shop archives (please see here: https://alex.bandiwork.dev/shop)
They don’t go fullwidth. I have inspected the page and I can see I gave grid-33 on .generate-columns, but I don’t know why and how to get rid of it.
Can you help, please?
Thank you so much!November 26, 2020 at 3:36 am #1549237David
StaffCustomer SupportHi there,
thats very peculiar …. can you check first for plugin conflicts by temporarily disabling all plugins apart from GPP and Woocommerce.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 26, 2020 at 6:07 am #1549513Alexandra
Hi, David!
Yes, I have disabled all plugins except for GP premium and Woo, but it’s the same π
Cleared cache too…
Is there anything else that could be done to fix the issue?
Thank you so much!November 26, 2020 at 7:19 am #1549893David
StaffCustomer SupportDo you have any custom functions or a child theme installed or made any other edits to the theme?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 26, 2020 at 10:23 am #1550323Alexandra
Oh, gosh! I feel so silly now!
Yes! With your help, I have figured out the issue is coming from this function I had added:add_filter( 'generate_blog_columns', function( $columns ) { $targets = array( 'articole-diverse', 'siguranta-pe-munte', ); if ( is_archive( $targets ) ) { return true; } return $columns; } );
I added this because I need columns on category archives for the custom post type called “articole” (siguranta-pe-munte & articole-diverse are categories for this custom post type).
Is there a way I can rewrite this function so that I can still have columns on these archives (sample CPT category archive page) without affecting shop product archives?
Thanks so much for this!
November 27, 2020 at 2:31 am #1551531David
StaffCustomer SupportGood find π
Try this snippet instead:add_filter( 'generate_blog_columns','db_cpt_columns' ); function db_cpt_columns( $columns ) { if ( is_post_type_archive( array( 'articole-diverse', 'siguranta-pe-munte' )) { return true; } return $columns; }
The main difference is the conditional tag:
is_post_type_archive
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 27, 2020 at 5:59 am #1551973Alexandra
Hi, David!
I tried the snipped, but unfortunately, it doesn’t solve my problem. I think it is intended for CPT archives, not for CPT category archives.
Sample CPT archive – it works, I have columns
Sample CPT category archive – it doesn’t workIs there another function I could use in order to have columns on CPT category archives?
Thank you!November 27, 2020 at 7:24 am #1552551David
StaffCustomer SupportQuestion – is there any other places that columns should be applied ? Then we can try and cover them all in one go.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 27, 2020 at 11:26 am #1553226Alexandra
Yes, I actually want columns on all archives.
November 28, 2020 at 9:25 am #1555188David
StaffCustomer SupportHave you enabled Columns in Customizer > Layout > Blog ? This would apply to all Post archives?
You would only then need the function provided here to set them for the CPT:https://generatepress.com/forums/topic/issue-with-woocommerce-shop-archives-grid-33/#post-1551531
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 28, 2020 at 10:19 am #1555267Alexandra
Yes, I have Columns enabled in the Customizer and I also placed that function, but I only have columns on post archives and CPT archives, not CPT category archives.
Please see my message above for CPT archive versus CPT category achieve.
How can I have columns also on CPT category archives?November 29, 2020 at 3:43 am #1556129David
StaffCustomer SupportTry this:
add_filter( 'generate_blog_columns','db_cpt_columns' ); function db_cpt_columns( $columns ) { if ( is_post_type_archive( array( 'articole-diverse', 'siguranta-pe-munte' ) || is_tax() ) { return true; } return $columns; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 29, 2020 at 6:21 am #1556328Alexandra
Unfortunately, it doesn’t work π
November 29, 2020 at 6:44 am #1556347Alexandra
I have finally figured it out!! π
This solved everything:
add_filter( 'generate_blog_columns','db_cpt_columns' ); function db_cpt_columns( $columns ) { if ( is_post_type_archive( array( 'jocuri', 'articole', 'review-uri' ) ) || is_category( ) || is_tag( ) ) { return true; } return $columns; }
In the array I had to include all my custom post types.
I tried many alternatives, but this is the only one that enabled me to have columns on post archives, CPT archives and CPT categogy and tags archives without messing with my product archives. Hope this helps anyone facing the same issues πNovember 29, 2020 at 6:45 am #1556348David
StaffCustomer SupportAah – its not a Custom Taxonomy!
Glad you found the answer π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.