Query string doubts

I want to create a section showing an image and a text + a URL button of the PARENT categories for WC products.

I thought the query builder would help but it seems it would not allow me to do this in a dynamic way (please correct me if i’m wrong an show me the right configuration for it). so i thought of creating a query string.

the example code would be this:

$args = [
'taxonomy'   => 'product_cat',
'hide_empty' => 0,
'parent'     => 0  // Ensures only top-level categories are fetched
];
$query_string = http_build_query($args);
echo $query_string;

Which would return

taxonomy=product_cat&hide_empty=0&parent=0

However if i add that to the homepage, for example, i get 0 results when i should get more or less 3.

what could i be doing wrong?

I’m adding it to the looper provider of a slide container btw, and the actual slider is the consumer where we have the image and the text elements.

Hey @franticape,

Thanks for writing in!

Please be advised that you cannot use the Looper Provider Query String to display parent categories. You will have to create your own PHP code that would display the parent categories and use it along with the Looper Provider Custom.

You can check out these old threads instead:

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.