Remove “Category:” from Post meta
Remove “Category:” from Post meta
Remove “Category:” from Post meta
Well, according to official documentation, you should pass depth argument inside your function. As it’s written here Try this: <?php wp_list_categories( array( ‘orderby’=> ‘id’, ‘order’ => ‘DESC’, ‘show_count’ => false, ‘use_desc_for_title’ => false, ‘title_li’ => ”, ‘depth; => 1 ) ); ?>
One option could be to have some kind of lookup table, either hard coded or as a settings page, where you map role (user group) to category (city). Then use the current user object to get city based role and use it as a key to get a category ID from the lookup table, which … Read more
Yes, get_category_children() is indeed deprecated and you should use get_term_children() instead. So with your original code: // You can simply replace this: if (get_category_children($this_category->cat_ID) != “”) // with this: $ids = get_term_children( $this_category->cat_ID, ‘category’ ); if ( ! empty( $ids ) ) And with your second code which uses get_terms(), you can check if the … Read more
The Shortcode to display products in “Fruits” category when user is on another page or archive… is: [products category=”fruits”] As far as I know there is no shortcode to display the parent category products without specifying the given category slug. For your 2nd example you will have to call it in your sub category “Pork” … Read more
I found a workable solution. The WooCommerce default templates don’t support the setting to show categories on the Shop page. However using a shortcode with do_shortcode(), and a condition this can be achieved as follows: if (is_shop()) { echo do_shortcode(‘[product_categories hide_empty=”0″]’); } else { woocommerce_product_loop_start(); if ( wc_get_loop_prop( ‘total’ ) ) { while ( have_posts() … Read more
In if…else condition, the else statement shows even if if statement is correct
You could use WP_Query and specifically a tax_query: $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => array( ‘allow-list’ ), ), array( ‘taxonomy’ => ‘post_tag’, ‘field’ => ‘slug’, ‘terms’ => array( ‘cats’ ), ), ), ); $the_query = new WP_Query( $args ); if … Read more
Exclude a category from block editor’s category widget
WooCommerce REST API not returning the default products category