taxonomy

Query multiple taxonomies group slugs

无人久伴 提交于 2020-01-06 18:10:29
问题 I have a checkbox function that I'm using for my search query. My problem is the url created when I search. ?ct_zipcode=&ct_event_type=birthday&ct_event_type=photovideo-shoot&Venue-search=true When I have multiple taxonomy_names checked I only get the last slug in my search results. I need my url to be rewritten like: ?ct_zipcode=&ct_event_type=birthday%2Cphotovideo-shoot&Venue-search=true Is there an easy way to change my url with rewrite? I've tried a little str_replace / preg_replace with

Query multiple taxonomies group slugs

孤街醉人 提交于 2020-01-06 18:10:12
问题 I have a checkbox function that I'm using for my search query. My problem is the url created when I search. ?ct_zipcode=&ct_event_type=birthday&ct_event_type=photovideo-shoot&Venue-search=true When I have multiple taxonomy_names checked I only get the last slug in my search results. I need my url to be rewritten like: ?ct_zipcode=&ct_event_type=birthday%2Cphotovideo-shoot&Venue-search=true Is there an easy way to change my url with rewrite? I've tried a little str_replace / preg_replace with

Adding a taxonomy tag to wordpress post by writing it in comment with hashtag

拜拜、爱过 提交于 2020-01-06 06:45:23
问题 In wordpress, I have a post with some tags. A user should be able to add a tag to the post by writing the tag with a hashtag in the comment, e.g. 'This is a comment that adds #orange' should add the tag orange. That is my code: function add_tag_from_comment( $comment_ID ) { $comment = get_comment($comment_ID); $search_text = strip_tags( str_replace( array( "\n", "\r"), $comment->comment_content)); preg_match_all('/#([\d\w-_]+)[\b|]{0,3}/', $search_text, $matches, PREG_PATTERN_ORDER); foreach(

WooCommerce - add column to Product Cat admin table

喜夏-厌秋 提交于 2020-01-05 02:55:15
问题 I would like to add a new column in the back-end table for Product Categories. This column will contain a link "view category" and will link all to the www.domain.com/category/category-name page. I looked into the Wordpress docs and this is the code I came up with... but it doesn't work! function product_cat_cpt_columns($columns) { $new_columns = array( 'Link' => "Link to page" ); return array_merge($columns, $new_columns); } add_filter('manage_product_cat_posts_custom_columns' , 'product_cat

Wordpress Query Posts Taxonomy

安稳与你 提交于 2020-01-03 05:58:11
问题 I currently have a checkbox based search and filter on my wordpress site. Basically it works using this wp_query $queryObject = new WP_Query(array("post_type"=>'toy','posts_per_page'=>999999, 'category__and' => $_POST['myListOfCategories'])); I want to move away from using categories (as it's making using the blog a pain) So I've set everything up using custom taxonomies now and notice there is no "taxonomy__and". Does anyone know of a way to use WP_Query to search for posts using taxonomies

How to get real term_meta using ACF with custom fields on taxonomy terms (instead of wp_options)

谁说我不能喝 提交于 2020-01-03 03:46:06
问题 Having a simple Woocommerce site, I'm using ACF pro to add some custom fields to the terms of a given taxonomy. Using this, I can, for example, add a "color" field to my "product category" taxonomy terms. Good. The issue: Wanting to do some query using get_terms() (codex), I discovered that my meta_query parameters were not working (unexpected results). Why ? My custom fields were not saved (from backend) as term_meta but as wp_option . It seems that ACF 4 is saving those fields, not as term

Custom taxonomy - setting access based on role or capability

帅比萌擦擦* 提交于 2019-12-30 07:48:03
问题 I am only just learning about custom taxonomies for Wordpress. How is it possible to restrict access for my users to use a taxonomy. For instance, I have created a taxonomy named featured and I only want Editors and above roles to be able to add posts to this taxonomy. How do I set the access level? Either based on user role or capability, both works for me. Here is the code that I use for my taxonomy: function add_custom_taxonomies() { // Add new "Featured" taxonomy to Posts register

Custom taxonomy - setting access based on role or capability

倾然丶 夕夏残阳落幕 提交于 2019-12-30 07:47:53
问题 I am only just learning about custom taxonomies for Wordpress. How is it possible to restrict access for my users to use a taxonomy. For instance, I have created a taxonomy named featured and I only want Editors and above roles to be able to add posts to this taxonomy. How do I set the access level? Either based on user role or capability, both works for me. Here is the code that I use for my taxonomy: function add_custom_taxonomies() { // Add new "Featured" taxonomy to Posts register

Get taxonomy links filtered by multiple taxonomy types

时光毁灭记忆、已成空白 提交于 2019-12-25 07:55:35
问题 I've build a website that has two 'departments', let's say 'shoes' and 'caps' . There are two link at the top of the website, and with those links people can switch departments, and depending on which department they are on the styling and content is a bit different, some parts are the same, others are not. For posts both of these departments are a taxonomy, so a new post can belong to either one, or both. There is also a taxonomy 'brands' . What I would like right now, is get a list of all

Comparing two stdClass Objects

ⅰ亾dé卋堺 提交于 2019-12-25 04:17:59
问题 I'm currently working on a modified search within a Wordpress theme that queries a custom taxonomy location and displays it's terms as search results. I couldn't find a built in Wordpress function to handle this, so I used a $wpdb query $keywords = $_GET['s']; $results = $wpdb->get_results( "SELECT * FROM $wpdb->terms WHERE name LIKE '%%$keywords%%'"); <ul> <?php foreach ( $results as $result ) :?> <li><?php echo $result->name;?></li> <?php endforeach;?> </ul> The issue with this is the table