I’d love to help. Can you give me a better idea of your setup? What CPTs do you have? What CPT-onomies do you have and what are they connected to? Do you have any CPT-onomies that used to be regular taxonomies? This can sometimes cause issues when printing out terms.
Thread Starter
dizda
(@dizda)
Thanks for helping out.
I have two CPTs: “Webshops” and “Acties”(promotions in Dutch).
Besides that I have WooCommerce installed which created the CPTs “Products”, “Variations”, “Coupons” and “Orders”.
I registered “Webshops” as a CPT-onomiy and attached it to “Acties” and “Products”.
I don’t have any CPT-onomies that used to be regular taxonomies.
Because the problem only applies to the “Products” CPT, I figured that unlinking “Webshops” should at least make it work again, but it doesn’t.
The problem only applies to Products? Hmm. Can you show me where they’re not showing up? Is this in the admin? Can you take a screenshot?
Thread Starter
dizda
(@dizda)
Yes it only applies to Products. The rest of the website is functioning normally.
There’s no problem in the admin, it’s only on the frontend.
This is what the hierarchy should look like:
– Main page: Shows all products of the child categories.
— Women: Shows all products of the child categories.
— Shoes: Shows all products of the child categories.
—- Sneakers: Show all products of the current category.
This is what the hierarchy looks like:
– Main page: Shows all products of the child categories. // Ok
— Women: Shows a few products of the child categories. // Not ok
— Shoes: Shows no products. // Not ok
—- Sneakers: Show all products of the current category. // Ok
So they’re being assigned in the admin but not showing up on the front end. This is gonna be tricky to troubleshoot without having access to the site.
Can you show me your queries?
Thread Starter
dizda
(@dizda)
Yes I know, it’s a strange problem, but it has to do something with child and parent categories.
I’m using the default WooCommerce templates, so it’s difficult to paste the code in here because it uses all kinds of template parts. I didn’t change any of the code so it’s just the one you can download.
If you need anything else, please let me know. I really appreciate your help solving this.
Are the “categories”, i.e. underwear and boxers, just a normal taxonomy called categories?
Thread Starter
dizda
(@dizda)
Yes it’s a normal taxonomy called Product Categories (product_cat).
So this is a taxonomy problem… not a CPT-onomy problem?
Is there anyway you can show me your query?
The following will print the query out on the page for you. Warning: the following will print the query out on the page for you.
add_action( 'pre_get_posts', 'my_website_print_wp_query' );
function my_website_print_wp_query( $query ) {
echo "<pre>";
print_r( $query );
echo "</pre>";
}
Thread Starter
dizda
(@dizda)
This is the query on a category product page: http://pastebin.com/qfdT4mJH
I forgot that that doesn’t include the request. Can you do this instead:
global $wp_query;
echo "<pre>";
print_r( $wp_query );
echo "</pre>";
at the top of your header file?
Thread Starter
dizda
(@dizda)
Thanks. This will be helpful. Let me do some research and I’ll get back to you ASAP.
Thread Starter
dizda
(@dizda)
Thanks so much Rachel. If there’s anything else I can help you with, just let me know.