custom-taxonomy

Wordpress - get_terms() returns “invalid taxonomy” (this is not a hook issue)

南笙酒味 提交于 2019-12-28 07:07:23
问题 On my local machine it works fine, but on the live server, when I run get_terms('taxonomy' => 'any_taxonomy'); it returns a list of terms, but if I add any parameter to it like: get_terms('taxonomy' => 'any_taxonomy','hide_empty' => false); Then it returns "invalid taxonomy". The issue is not that the taxonomy is not registerd get_taxonomies() before it, it shows that all the taxonomies are registered. If I do this: get_terms('taxonomy' => 'category','hide_empty' => false); The same problem

Wordpress - get_terms() returns “invalid taxonomy” (this is not a hook issue)

我怕爱的太早我们不能终老 提交于 2019-12-28 07:07:08
问题 On my local machine it works fine, but on the live server, when I run get_terms('taxonomy' => 'any_taxonomy'); it returns a list of terms, but if I add any parameter to it like: get_terms('taxonomy' => 'any_taxonomy','hide_empty' => false); Then it returns "invalid taxonomy". The issue is not that the taxonomy is not registerd get_taxonomies() before it, it shows that all the taxonomies are registered. If I do this: get_terms('taxonomy' => 'category','hide_empty' => false); The same problem

Storing terms in post array and returning corresponding posts on form submit

你说的曾经没有我的故事 提交于 2019-12-25 05:37:11
问题 I have a list of taxonomy terms with checkboxes that post as an array on form submit to a page template called Post List. My goal here is to list taxonomy terms with checkboxes, then on form submit, display the corresponding posts that have the checked terms assigned to them e.g. <?php $terms = get_terms("the_taxonomy"); $count = count($terms); if ( $count > 0 ){?> ?> <form action="<?php echo esc_url( get_permalink( get_page_by_title( 'Post List' ) ) ); ?>" method="post"> <?php foreach (

Wordpress prefix dynamic value to custom taxonomy url

£可爱£侵袭症+ 提交于 2019-12-25 03:44:08
问题 I have two custom taxonomies 'edition' and 'features' I'd like wordpress to allow me to prefix the slug of features with a value from editions. For example if i go here; mysite.com/asia/features/interviews/ Wordpress would translate the url to; mysite.com/index.php?features=interview&edition=asia and then loading the features taxonomy template where i can then grab the edition query_var and filter the templates accordingly. I'm thinking playing around with add_rewrite_rule would sort it am

Pulling in image from custom taxonomy with ACF

爷,独闯天下 提交于 2019-12-25 02:57:40
问题 So here is what i'm trying to do. I have created a custom taxonomy called "country" and within that custom taxonomy I have categories of different countries like, USA, France, Germany, England and so on. I created a ACF(Advance custom field) Field Group that lets me add a image to each country, I have this called "flag". So when I make a post and I check the country under the custom taxonomy I need to pull that image (flag) associated with that category and display it on my page. I have seen

Use Taxonomy ACF to affect Custom Taxonomy post count

爷,独闯天下 提交于 2019-12-24 16:39:31
问题 Is there a way to use an "ACF Taxonomy Field" to affect "Custom Taxonomy" post count? Right now I am using ACF Taxonomy Field, but my Custom Taxonomies have 0 posts assigned. I want to use ACF to assign Custom Post to Custom Taxonomy: Instead of the default way: Is this possible? I'm trying to do this way because it is more friendly to the end-user and ACF is more flexible; I can restrict it if I need the user to select only one taxonomy and make other restrictions. 回答1: Very big and basic

Exclude variations with 2 specific attribute terms from coupon usage in Woocommerce

风流意气都作罢 提交于 2019-12-24 11:16:26
问题 I need to prevent coupons being used if customer have any specific product variations in their cart with following attribute terms: attribute_pa_style => swirly attribute_pa_style => circle I've looked through the Woocommerce scripts that apply to restricting specific products and specific categories, but can't figure it out with regard to attributes and all coupons. Any help is appreciated. 回答1: This can be done using woocommerce_coupon_is_valid filter hook this way: add_filter( 'woocommerce

Exclude variations with 2 specific attribute terms from coupon usage in Woocommerce

社会主义新天地 提交于 2019-12-24 11:11:29
问题 I need to prevent coupons being used if customer have any specific product variations in their cart with following attribute terms: attribute_pa_style => swirly attribute_pa_style => circle I've looked through the Woocommerce scripts that apply to restricting specific products and specific categories, but can't figure it out with regard to attributes and all coupons. Any help is appreciated. 回答1: This can be done using woocommerce_coupon_is_valid filter hook this way: add_filter( 'woocommerce

Mandatory Coupon code for specific Woocommerce product category items

百般思念 提交于 2019-12-24 06:32:22
问题 In Woocommerce, I'm trying to make a Coupon Code mandatory for all Products from a specific Category. The following code (placed in functions.php) works well, but makes Coupon Codes mandatory for all Products regardless of the product category: add_action('woocommerce_check_cart_items', 'make_coupon_code'); function make_coupon_code() { global $woocommerce; if(is_cart() || is_checkout()){ $my_coupon = $woocommerce->cart->applied_coupons; echo $woocommerce->cart->get_applied_coupons; if(empty(

Display product attributes on specific Woocommerce product category archives page

无人久伴 提交于 2019-12-24 05:19:10
问题 I want to show two attributes on the category pages, with the attribute name and value only on specific categories. This code that I found displays the labels of the attributes, but is duplicating the value and I am really struggling with a show if categories variable. Any help is greatly appreciated. The code: add_action('woocommerce_after_shop_loop_item','add_attribute'); function add_attribute() { global $product; $product_attributes = array( 'pa_set', 'pa_team'); $attr_output = array(); /