- This topic has 9 replies, 2 voices, and was last updated 6 months, 1 week ago by
David.
-
AuthorPosts
-
July 16, 2020 at 5:31 am #1365463
Claudia
Hi Tom, David and Leo (I don’t know if I’m missing someone)
First of all, we really appreciate the work you are doing with GP π
To the point, I’ve tried to find the solution in the forum, but I couldnt. We are running Niche theme, and we’ld like to show the woocommerce product categories in shop pages (shop index, single product, and I any other wc page)
I’ve checked and we have the “Woocommerce Shop Category Menu” Element enabled (see below). As far as I checked the code is not generated in the html. I don’t know what we are doing wrong. Can you help us? Or any idea how to proceed?
Thank you in advance<?php $cat_args = array( 'orderby' => 'name', 'order' => 'asc', 'hide_empty' => false, ); $product_categories = get_terms( 'product_cat', $cat_args ); if ( ! empty( $product_categories ) ) { echo '<ul class="woo-cat-nav">'; foreach ( $product_categories as $key => $category ) { printf( '<li> <a href="%1$s"> %2$s </a> </li>', get_term_link( $category ), $category->name ); } echo '</ul>'; }
?>
Hook woocommerce_archive_description
Execute PHP YES
Display Rules- Product Category Archive: All Product Categories
- Product Archive
July 16, 2020 at 6:32 am #1365523David
StaffCustomer SupportHi there,
Lets test if the hook is where it should be.
In your hook code above, just before the<?php
add:<h2>The hook is working</h2>
If that displays on the front end we know the hook is working. Let me know. Then we can look at why the codes conditions aren’t being met
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/July 16, 2020 at 7:02 am #1365553Claudia
Hi David,
Nope, it doesn’t display itJuly 16, 2020 at 7:29 am #1365587David
StaffCustomer SupportThat means that either:
1. The Display Rules are not working.
OR
2. The Hook is missing.Lets test #1 – by adding
Entire Site
to the Hooks Display Rules.Let me know.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/July 16, 2020 at 7:44 am #1365591Claudia
Ok, adding to display for the entire site didn’t work
July 16, 2020 at 7:58 am #1365747David
StaffCustomer SupportNow try changing the hook to
after_header
Keep the Display Rules as is.
And keep the<h2>The hook is working</h2>
in there.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/July 16, 2020 at 8:55 am #1365853Claudia
Ok, I’ve got something π
Changing the hook to after_header make it appear in the single product page. Not in the shop page. Even more, it appeared all the categories. You can check by yourself in the provided linkJuly 16, 2020 at 9:05 am #1365862David
StaffCustomer SupportOK – something else must be interfering.
Are you using a Child Theme ? If so can you temporarily disable it.Next step is to disable any other plugins or custom functions to see if there is a conflict.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/July 16, 2020 at 10:39 am #1365951Claudia
SOLVED!
It was the plugin “Productos sin stock” (that orders the WC products with no stock at last position)
Thank you David!July 17, 2020 at 1:58 am #1366442David
StaffCustomer SupportGlad to hear you found the issue.
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.