taxonomy

Get current Category Name on a page which filters posts by Category and custom meta_key

时光怂恿深爱的人放手 提交于 2019-12-14 02:11:27
问题 I'm successfully filtering all my WordPress posts (in a custom page template) by Likes (count) with a Custom Plugin (and meta_key) which also let me filter the most liked posts in a specific category with the following if (isset($_GET['category'])) { $args = array( 'meta_key' => '_recoed', 'meta_compare' => '>', 'meta_value' => '0', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'category_name' => sanitize_text_field($_GET['category']), 'paged' => $paged ); } query_posts($args); get

Add current_cat class on wp_list_categories when I'm on single with custom taxonomy

浪尽此生 提交于 2019-12-13 21:23:07
问题 I search all the web for that answer. I use wp_list_categories to make a submenu with custom taxonomy, It works well, and puts current-cat when I browse those categories. The thing is, when I browse single posts with this menu, the highlight no more works. For the blog part of that site, I use the following code to highlight current category on wp_list_categories(): function sgr_show_current_cat_on_single($output) { global $post; if( is_single() ) { $categories = wp_get_post_categories($post-

Drupal 6: Views: Listing taxonomy terms with tagged nodes underneath

 ̄綄美尐妖づ 提交于 2019-12-13 16:22:00
问题 I need to create a view that lists out taxonomy terms and then list the top 3 recent(sort by node:date updated) nodes with that tag example out put: Article Article 1 Article 2 Article 3 Podcast Podcast 1 Podcast 2 Podcast 3 . . . I created a view of type "Term" and I can get the view to output all of the terms. However, I don't see how to link in the nodes tagged with the taxonomy term. I looked around in the view of type node, but I couldn't get anywhere close to what I needed to output.

Can Drupal terms in different Taxonomies be synonymous?

梦想的初衷 提交于 2019-12-13 12:31:32
问题 Let's say Taxonomy_A is associated to Node_Type_A Taxonomy_B is associated to Node_Type_B . AND Both Taxonomy_A and Taxonomy_B have a term called ' yellow '. Is it possible to make terms ' yellow ' synonymous, so that if I'm looking at a list of ' yellow ' stuff, I'm seeing content of both types ( Node_Type_A , and Node_Type_B )? Progress: Unfortunately it is not possible for taxonomy terms to behave in Drupal as described in my question (at least not without forcing it): It is clear by

Wordpress: How can I exclude posts in child taxonomies from a custom taxonomy query?

你说的曾经没有我的故事 提交于 2019-12-13 12:18:56
问题 My WordPress theme has a custom taxonomy called "Collections". The custom taxonomy is hierarchical, so there are subcollections. I have a Collection called "Books" and a sub-collection called "Novels". There are some posts that are just in "Books", and some posts that are in "Novels". I want the page for the "Books" collection to only show posts in the main "Books" collection, not the ones in the "Novels" subcollection. But by default, WordPress includes posts in "subcollections" in the query

Spree: intersection between taxons

百般思念 提交于 2019-12-13 03:34:34
问题 Is it possible to query for products that belongs to multiple taxons? Like a math intersection. For example: I sell books that belongs to taxon Universities > ASU, and belongs to taxon Course > Engineering I would like to be able to query for all books that belongs to the ASU Engineering path. Something like Spree::Product.in_taxon(asu_taxon).in_taxon(eng_taxon) 回答1: There's a few ways to do this. I'm going to use the spree sandbox data, so you can try the results if you're interested. First,

Show parent taxonomy in custom post type

自古美人都是妖i 提交于 2019-12-12 17:23:43
问题 I have a set of schools in a custom post type with locations ordered as follows: London - 1 Oxford Road - 2 Cambridge Road Paris - 1 Napoleon Road - 2 Tower Road How do I change the following so that the location parent is outputted instead of the location child: // begin loop $args = array('post_type' => 'school'); query_posts($args); if ( have_posts() ) : while ( have_posts() ) : the_post(); // variable for location $location = get_the_term_list( $post->ID, 'location', '', ', ', '' ); //

Filter wp_list_categories from one custom post type

亡梦爱人 提交于 2019-12-12 05:35:30
问题 I have 2 custom post types called 'project' and 'client' that share a taxonomy called 'sector'. if (!is_taxonomy('sector')) { register_taxonomy( 'sector', array('project', 'client'), array( 'hierarchical' => true, 'label' => 'Sector', 'query_var' => true, 'rewrite' => array( 'slug' => 'sector' ), 'with_front' => false ) ); wp_insert_term('Health', 'sector'); wp_insert_term('Clubs', 'sector'); wp_insert_term('Commercial', 'sector'); } I have created a taxonomy archive template with a sidebar

Wordpress using get_term to retrieve slug not working as expected

霸气de小男生 提交于 2019-12-12 04:29:37
问题 I'm using the below code to try and get the slug for the current category and the parent category. I've managed to get as far as getting the currently cat slug but the parent displays in readable text and nut slug format. Where am I going wrong? <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $parent = get_term($term->parent, get_query_var('taxonomy') );?> <?php echo do_shortcode("[ecs-list-events cat='{$term->slug}']"); ?> <?php echo $term->slug;

Custom Taxonomy Slug Hook? [closed]

♀尐吖头ヾ 提交于 2019-12-12 03:49:18
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . To avoid naming issues I decided to attempt to change the url slug as its being submitted, by appending a "unique-to-taxonomy" suffix. What is the hook for doing something like this? How would it be used? 回答1: I