Query Product categories what have a custom field

Im trying to build a page template on wordpress that will show a list a categories that have a custom field checked.

So the taxonomy is just the default woocommerce taxonomy product_cat I then have a custom field to the product_cat taxonomy which is a check box called collectable

My set up is
Main Category

  • Child
  • Child
  • Child
  • Child

So for example 2 children categories have the tick box collectable which is set to add the value of 1 into the datbase

So I am doing a page where it will show all categories with the collectable checked.

$args = array(
    'post-type' => 'product',
    'taxonomy' => 'product_cat',
    'hide_empty' => 0
  );
  $c = get_categories($args);
  $c_keep = array();
  foreach($c as  $cat){
 if (get_field('collectable', 'category_'.$cat->term_id)) {
      $c_keep[] = $cat;
    }  
  }
  
  foreach($c_keep as $cat){
    echo $cat->name;
  }

But I am getting nothing at all returned.

I even put a

print_r( $args );

But I am still coming up with a blank (Header and footer Loads and the text above the query)

Can anyone help please

Go to Source
Author: user1348927

How to reorder hooks output order of Seconday menu and Product search (Storefront theme)

I would like to center Product search on about the same line with Site logo and align right on the same line the secondary menu on site https://prettify.ru (I’m not advertising or something… I put a link just to be more concrete on the subject. Hopely it is not against rules).
The default hooks’ output for Storefront theme is like this

  1. Site Branding (logo e.t.c.)
  2. Secondary menu
  3. Product search
  4. Primary navigation menu

e.t.c.

I was trying to play with CSS with that set up but it seems pretty hard for me (I’m a noob, ha ha) to center Product Search for all resolutions with that hooks order.
My Idea how to do habdle this is to change output priorities: show Product search right after Site Branding and then Show Secondary menu. Only after that play with CSS rules/styling.

What I’m see at storefront-template-hooks.php is

add_action( 'storefront_header', 'storefront_header_container', 0 );
add_action( 'storefront_header', 'storefront_skip_links', 5 );
add_action( 'storefront_header', 'storefront_site_branding', 20 );
add_action( 'storefront_header', 'storefront_secondary_navigation', 30 );
add_action( 'storefront_header', 'storefront_header_container_close', 41 );
add_action( 'storefront_header', 'storefront_primary_navigation_wrapper', 42 );
add_action( 'storefront_header', 'storefront_primary_navigation', 50 );
add_action( 'storefront_header', 'storefront_primary_navigation_wrapper_close', 68 );

No call for search function. My logic was like that: find output for product search and set priority higher than storefront_secondary_navigation: let say 25. But I can not find where the search priority is set up. I’m using AJAX Search for WooCommerce plugin and that makes things to be a bit more complicated, he he.
Can someone please suggest how to reorder items in header?
Will it work for my target: center cearch and align secondary menu right?

Go to Source
Author: 0LEg