categories

Symfony form category - subcategory

心不动则不痛 提交于 2021-01-29 06:01:26
问题 I try to make a form with category and subcategory like the picture below : So, I made my form like that : ->add('souscategorie', EntityType::class, array( 'label' => false, 'class' => 'App:souscategorie', 'query_builder' => function(EntityRepository $er) { return $er->createQueryBuilder('souscategorie') ->leftJoin('souscategorie.categorie', 'categorie') ->addSelect('souscategorie') ->addSelect('categorie') ; }, 'expanded'=> true, 'multiple'=> true, 'choice_label' => function($sousCategorie){

get sub categories of several categories with get_categories()

落爺英雄遲暮 提交于 2021-01-28 20:06:46
问题 Is there a way to get all sub categories of several categories? something like: get_categories( array( 'child_of'=>array(10,3,8) ); 回答1: It's not possible, wordpress just accepts one integer in all it's functions that get categories children. You'll have to get their children separately: $terms = array(); $taxonomy = 'category'; $parents = array(10, 3, 8); foreach ($parents as $parent) { $terms = array_merge($terms, get_categories(array('child_of'=> $parent))); } foreach ($terms as $term) { /

Hide subcategories from woocommerce category widget

Deadly 提交于 2021-01-28 06:21:51
问题 I'm using the built-in woocommerce category widget, and at the moment it's displaying both the categories and subcategories. I excluded a category via this code: add_filter( 'woocommerce_product_categories_widget_args', 'organicweb_exclude_widget_category' ); function organicweb_exclude_widget_category( $args ) { // Enter the id of the category you want to exclude in place of '30' $args['exclude'] = array('62' ); return $args; } but the widget still shows it's subcategories. link: http:/

Exclude a WooCommerce product category from a WP_Query

无人久伴 提交于 2021-01-05 07:19:24
问题 I've got the following args defined as a part of my query: $args = apply_filters('woocommerce_related_products_args', array( 'post_type' => 'product', 'author' => $artist, 'post_status' => 'publish', 'meta_query' => array( array( 'key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN' ) ) ) ); $products = new WP_Query( $args ); I need to exclude a category called Magazines (slug "magazines") or ID 351 from the query. I've been trying to include 'category__not_in' =>

Exclude a WooCommerce product category from a WP_Query

孤街浪徒 提交于 2021-01-05 07:17:09
问题 I've got the following args defined as a part of my query: $args = apply_filters('woocommerce_related_products_args', array( 'post_type' => 'product', 'author' => $artist, 'post_status' => 'publish', 'meta_query' => array( array( 'key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN' ) ) ) ); $products = new WP_Query( $args ); I need to exclude a category called Magazines (slug "magazines") or ID 351 from the query. I've been trying to include 'category__not_in' =>

Add channel to category by name

强颜欢笑 提交于 2020-12-30 07:42:31
问题 var server = message.guild; for (var i = 0; i < server.channels.array().length; i++) { server.channels.array()[i].delete(); } server.createChannel("Text Channels", "category"); server.createChannel('general', "text"); I am trying to make the text channel 'general` go into the category 'Text Channels' All the solutions I have found rely on you knowing the categories id . I was wondering if there is a way I could get the category id , or else move general into "Text Channels" simply by its name

Add channel to category by name

白昼怎懂夜的黑 提交于 2020-12-30 07:42:05
问题 var server = message.guild; for (var i = 0; i < server.channels.array().length; i++) { server.channels.array()[i].delete(); } server.createChannel("Text Channels", "category"); server.createChannel('general', "text"); I am trying to make the text channel 'general` go into the category 'Text Channels' All the solutions I have found rely on you knowing the categories id . I was wondering if there is a way I could get the category id , or else move general into "Text Channels" simply by its name

Remove add cart button in Woocommerce for a specific product category

醉酒当歌 提交于 2020-12-05 11:35:22
问题 I have an issue how to remove a cart from a category product. It works just fine if I apply it to a specific id or all in general, but I am unable to do it for a category. Below is my code I have done regarding it. Also, I am struggling to apply this same pattern to Related Articles section, so any help would be appreciated. Thank you. //function for deleting .... function remove_product_description_add_cart_button(){ global $product; //Remove Add to Cart button from product description of