Change slug of Standard wp Post category
Why are you going to functions.php? Go to Settings > Permalinks and use something/%category% as your Category base
Why are you going to functions.php? Go to Settings > Permalinks and use something/%category% as your Category base
You have copy the archive-product.php in your template folder in the woocomerce folder. Then you edit the file and basically run a loop trough the catgeories you want (for example you category id’s are 12 and 24); $product_categories = array(12,24); foreach($product_categories as $category){ $product_options = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘product’, ‘orderby’ => ‘menu_order’, … Read more
Use the pre_get_posts filter to remove your sticked product from the product loop. add_action( ‘pre_get_posts’, ‘exclude_stycky_product’ ); function exclude_sticky_product(){ // target only the main query if ( ! is_admin() && $query->is_main_query() ) { $query->set(‘ignore_sticky_posts’); $query->set(‘meta_value’, ‘1’); } } Hope it helps you !
It sounds like you’re trying to get the category terms for a post. Category terms are not stored in post meta. You can get a post’s terms using get_the_terms(). In this example, $terms will hold an array of term objects for the category taxonomy associated with the current post. You can replace category with your … Read more
In Admin panel, Under Settings -> Permalinks, you need to update Categtory Base as well. For example, using “blog” as your category base would make your category links like https://www.teacherdavid.co.uk/blog/%category%/%postname%/ If you leave these blank the defaults will be used.
There are three ways you can do this: 1) Create “For Free” category and assign it to all products which have price “0”. Then place “Product Categories” widget in sidebar so that user can click on “For Free” category and it will show all products from all categories where price is zero. 2) This option … Read more
Just call get_categories(). You’ll get back an array of term objects: array( [0] => WP_Term Object ( [term_id] => [name] => [slug] => [term_group] => [term_taxonomy_id] => [taxonomy] => Echo show_count of categories separately without using wp_list_categories => [parent] => [count] => [filter] => ) ) You can process this with wp_list_pluck to turn it … Read more
You can use get_terms(): <?php $args = array( ‘taxonomy’ => ‘name-of-the-category’, ‘meta_query’ => array( array( ‘key’ => ‘ref’, ‘value’ => ‘53113’, ), ), ); $terms = get_terms( $args ); You would get an array of terms, where the ref value would be 53113.
I have a similar code that is working fine for me. Try putting your ids into an array like so: $cat_args[‘exclude’] = array(’12, 13′);
I figured it out first set the terms to post through wp_set_object_terms and then run a update query in term_taxonomy table and set parent id of the the second term to first term. $taxo = wp_set_object_terms( $news_arr[0], utf8_encode($news_arr[2]), ‘vehicle_models’, $append = false ) ; $child = wp_set_object_terms( $news_arr[0], utf8_encode($news_arr[3]), ‘vehicle_models’, $append = true ) ; … Read more