Exclude a term of a taxonomy with a custom post type in a search

The problem with your approach is that woocommerces product category is a custom taxonomy called product_cat. But with cat you are addressing the built-in category. Taxonomies can be addressed with a tax query, simplified example below: function wpse188669_pre_get_posts( $query ) { if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) { $query->set( ‘post_type’, array( ‘product’ … Read more

How can I add an extra WooCommerce hook

You can create a hook by calling do_action, then referring to the hook in your functions.php with add_action. For example, in the theme, where you want the action to occur: do_action(‘woocommerce_before_single_product_intro’); Then in functions.php add_action(‘woocommerce_before_single_product_intro’,’your_function’,[…]); For the sake of maintainability, I’d choose a naming convention that doesn’t confuse your hooks with WooCommerce’s.

How to change Woocommerce breadcrumbs content?

That is due to the fact, that your filter woocommerce_breadcrumb doesn’t even exist. This filter here works and pulls out all the elements, that are currently in the breadcrumb (as an array): add_filter( ‘woocommerce_get_breadcrumb’, ‘change_breadcrumb’ ); function change_breadcrumb( $crumbs ) { var_dump( $crumbs ); return $crumbs; } And this filter pulls out the main term … Read more

Reflect nested categories in appearance > menus

Seems to be a long-standing issue. This plugin seems to do the trick. I’ve also found an alternative solution (which I’ve posted in the thread). Reproduced below: <?php add_filter( ‘nav_menu_meta_box_object’, ‘disable_pagination_in_menu_meta_box’, 9 ); function disable_pagination_in_menu_meta_box($obj) { $obj->_default_query = array( ‘posts_per_page’ => -1 ); return $obj; } ?> Update: Needs to be added with priority 9 … Read more

In WooCommerce I need to modify the thankyou.php page [closed]

I ended up inserting the payment description. (the one you specify in the woocommerce settings in the WordPress backend) The “native” build-in woocommerce payment-text is static and doesn’t relates to the actual selected payment method. 🙁 I did this by modifying the woocommerce template file: 1: Copy this template file: ..wp-content/plugins/woocommerce/templates/checkout/thankyou.php to your-theme-folder/woocommerce/checkout/thankyou.php 2: Replace … Read more

Detect whether a page is a product subcategory page?

is_category() only check the built in post category. Product categories are custom taxonomies. So you need to use is_tax() instead of is_category() and get_term() instead of get_category(). Check this example:- function is_subcategory($cat_id = null) { if (is_tax(‘product_cat’)) { if (empty($cat_id)){ $cat_id = get_queried_object_id(); } $cat = get_term(get_queried_object_id(), ‘product_cat’); if ( empty($cat->parent) ){ return false; }else{ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)