Displaying only selected categories
You should be using get_term_link( $category->slug,’category’ ) to get the category url refer link
You should be using get_term_link( $category->slug,’category’ ) to get the category url refer link
Please explain the logics of 2 menus displayed on same page. I believe you menu structure is as follows: first dishes – fish – chicken second dishes – fish – chicken So your main categories are ones like “first dishes” and “second dishes” How do you want to show main categories – as separate menus? … Read more
If you know the parent category name, then you could just do an if inside the foreach Demo code <?php foreach((get_the_category()) as $category) { if($category->cat_name!=”parent category name”) { echo ‘<a class=”tag-cat ‘ . $category->slug . ‘” href=”‘ . get_category_link($category->cat_ID) . ‘”>’ . $category->cat_name . ‘</a>’; } } ?> ?>
$images = rwmb_meta( ‘field-id’, array( ‘size’ => ‘image-size’, ‘limit’ => 1 ) ); $image = reset( $images ); echo $image[‘url’]; reference
found the code that do the trick $terms = get_the_terms( $product_id, ‘my_taxo’ ); foreach ($terms as $term) { $product_cat = $term->name; } echo $product_cat ; from below discussion https://stackoverflow.com/questions/33495716/get-the-product-categories-and-display-it-on-cart-page-woocommerce Thanks for the authors
you can try below code $term = get_term( get_the_ID(), ‘portfolio_category’); $slug = $term->slug; echo $slug;
I found there were 195 dp_* settings missing the correct settings in the ‘wp_postmeta’ table, once they were replaced it worked. I assume they were lost during the migration.
Something like this, I believe: $args = array( ‘number’ => -1, ‘hide_empty’ => false ); $product_categories = get_terms( ‘product_cat’, $args ); foreach( $product_categories as $cat ) { if ( $cat->count <=1 ) { wp_delete_term( $cat->term_id ); } }
You’re nearly there, all that is left is to check on which page you currently are. In the following code I’m first creating an array where the key corresponds to the page number and the value are the categories to exclude. This results in only one time writing $query->set(…. And to be really sure that … Read more
Removing catagory for new blog pages