custom-taxonomy

wordpress add an image to a taxonomy actor

不打扰是莪最后的温柔 提交于 2019-12-11 06:34:45
问题 I was wanting to add a image to my custom taxonomy actor, but when I look in the edit actor options it only shows the options name, slug & description. I need to add an option in the functions.php for the above mentioned problem. //////////////////////////////////// // TAXONOMY ACTORS // //////////////////////////////////// register_taxonomy( 'actor', array( 'movies' ), array( 'labels' => array( 'name' => __( 'Actors' ), 'singular_name' => __( 'Actor' ), 'search_items' => __( 'Search Actors'

Shipping methods - Local Pickup option not available when Flat Rate is hidden

故事扮演 提交于 2019-12-11 05:08:33
问题 Based on this answer (code below), I successfully can hide flat rate from particular product category and local delivery option is available. This is working perfect. The problem: local pickup option is NOT available for that particular category. How can I make the local pickup option available to this special category? This is the code that I use: function custom_shipping_methods( $rates ){ // Define/replace here your correct category slug (!) $cat_slug = 'your_category_slug'; $prod_cat =

Custom cart item currency symbol based on product category in Woocommerce 3.3+

给你一囗甜甜゛ 提交于 2019-12-11 04:42:52
问题 I want to display a custom currency symbol based on product category. I took the following snippet suggested on this question Change currency symbol based on product category in Woocommerce. However I actually need the custom currency to be displayed also in all Woocommerce pages (including cart and checkout page). This is my code: add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2); function change_existing_currency_symbol( $currency_symbol, $currency ) {

Check for Product Category in cart items with WooCommerce

喜你入骨 提交于 2019-12-11 04:18:01
问题 I'm trying to make a condition, where a function displays on WooCommerce checkout page only, if any product from category ilutulestik is present in the shopping cart. Currently, however, it does not seem to be able to obtain cart info. I assume that because, if I use if ( $cat_in_cart ) condition on a code, the function I use it on, does not display, even if I have a product from ilutulestik category present in the shopping cart. I've tried many different methods to obtain cart info, but none

Auto remove Sale product category from not on sale products in Woocommerce

柔情痞子 提交于 2019-12-11 04:09:51
问题 In woocommerce I am using the code from this answer thread that assign a "Sale" product category to a product that is on sale (so with an active sale price) . I have tried to remove "Sale" product category when the product is not on sale anymore without success. Is it possible to automatically remove products from the "Sale" category when they are not anymore on sale? 回答1: The following version code will automatically remove products from the "Sale" category when they are not anymore on sale:

Get and display the product category featured image in Woocommerce

[亡魂溺海] 提交于 2019-12-11 03:07:06
问题 I'm making my first theme and everything is progressing real fast thanks to all the assistance offered by The Loop and WooCommerce's SDK. Then today I spent an entire day failing to do something as simple as showing an image... After an entire day of struggling the only things I managed to learn is that WP seems to offer NO means for fetching a category's image and MANY people have asked this question for many years and STILL I can't find a way to ACTUALLY do it... :( What I want to do is

Filter Woocommerce products based on custom product attribute value

荒凉一梦 提交于 2019-12-11 02:13:28
问题 In Woocommerce, I have a product attribute called restriction_id . I am wanting to filter the products based on certain restriction id's . For example if a value is set to 35 in a php session variable I want to filter out any product that has the attribute for restriction_id set to 35 . What would I put in here? Here is my starting code: // Define the woocommerce_product_query callback function action_woocommerce_product_query( $q, $instance ) { // The code }; // Add the action add_action(

Add a custom field to Woocommerce products for a specific product category

[亡魂溺海] 提交于 2019-12-11 00:37:44
问题 I'm trying to add a custom field to the single product page for products in a specific category. I'm having problems with the conditional logic tho. This is what I've got so far: function cfwc_create_custom_field() { global $product; $terms = get_the_terms( $product->get_id(), 'product_cat' ); if (in_array("tau-ende", $terms)) { $args = array( 'id' => 'custom_text_field_title', 'label' => __( 'Custom Text Field Title', 'cfwc' ), 'class' => 'cfwc-custom-field', 'desc_tip' => true, 'description

List product categories hierarchy from a product id in Woocommerce

北城余情 提交于 2019-12-10 23:33:13
问题 I have a products that can be in multiple categories, example take a look at the following strings: Cat1>Product1 Cat1>Product2 Cat2>subcat1>Product1 Cat3>subcat1>subcat2>Product1 In woocommerce, if I have a productid, I can do the following: function alg_product_categories_names2( $atts ) { $product_cats = get_the_terms( $this->get_product_or_variation_parent_id( $this->the_product ), 'product_cat' ); $cats = array(); $termstest= ''; if ( ! empty( $product_cats ) && is_array( $product_cats )

Add custom fields in custom taxonomy meta box in wordpress-3.5.2

随声附和 提交于 2019-12-09 21:04:27
问题 Unable to add custom fields in custom taxonomy meta box in wordpress-3.5.2. I have checked solution in various blogs but Unable to solved this problem. I am using wordpress-3.5.2 What I am trying is :- // A callback function to add a custom field to our "adtag" taxonomy add_action( 'adtag_edit_form_fields', 'adtag_callback_function', 10, 2); // A callback function to save our extra taxonomy field(s) add_action( 'edited_adtag', 'save_taxonomy_custom_fields', 10, 2 ); I have tried solution from