Tag Info

New answers tagged

1

I may suggest not combining each of these into hierarchical taxonomies, but setting up 3 distinct taxonomies. It seems like they are 3 unrelated properties of the photos, and thus, I would separate the code for them. Then you're not trying to code around nested taxonomy terms, but you can access them each individually. The taxonomies would be color, location ...


2

You cannot use the same object of WP_Query twice. Therefore you need to create another one with a tax_query parameter to fetch posts which are not assigned to any term. //fetch all reviews which have no assigned term in 'review-product' $taxonomy = 'review-product'; $post_type = 'reviews'; $args = array( 'post_type' => $post_type, 'tax_query' ...


0

I have found a solution. Again, my goal was to display terms (not posts) from my custom taxonomy via an on/off switch. To do this, I used Advanced Custom Fields and created a "Select" field with two values (on/off). Once this field was applied to my taxonomy I could select a value for each term. The default value was set to "off". Now to display only the ...


0

I have found a solution. Thanks to @Tarukus as his answer was helpful. Again, my goal was to display terms (not posts) from my custom taxonomy via an on/off switch. To do this, I used Advanced Custom Fields and created a "Select" field with two values (on/off). Once this field was applied to my taxonomy I could select a value for each term. The default value ...


6

For starters let's dive into what is 5 really. It is the post's ID. But what is ID in turn? It is value in the MySQL table row which identifies the specific post record. Issues with using IDs So first there are some conceptual problems with it. It's not content. It's not something user creates, manipulates, or (most of the time) aware of. WP is (by design) ...


0

Hy, From what I understand you want a filter to display posts that belong to a specific list of terms. As default you display all posts making all terms enabled. In order to disable a term from being displayed you need to exclude it from the loop. <?php // we get all the terms of the taxonomy $terms = get_terms('mytaxonomy'); /* ...


6

This question is going to get some opinion based answers, but well, I'll give it a try. There are a couple of reasons why someone might've told you that, it would be great to know the context also. Upto version 3.4 or 3.5, that function only worked when the parameter was a var, that might be one of the reasons why someone told you that. I, myself, don't ...


0

get_terms has different parameters then get_posts. It seems like you are using get_terms as if it was get_posts.


0

You should use get_posts() first before you catch terms. $posts = get_posts(array( 'numberposts' => -1, 'post_type' => 'event', 'meta_key' => 'location', 'meta_value' => 'melbourne'));


0

You are looking for function get_term_link. Example $my_term_link = get_term_link($cat_lists); Here $cat_lists is term object. Official Documentation


2

There is no way easy way to do that. You have to query directly to achieve that. I am assuming, you only want the parent categories which don't have descendants or even if they have descendants, it's not used in any post global $wpdb; $categories = $wpdb->query("SELECT $wpdb->terms.* FROM $wpdb->terms ...


2

You might be able to accomplish this using Advanced Custom Fields: http://www.advancedcustomfields.com/resources/taxonomy/ Field groups, like the taxonomy field, can be assigned to templates. Editing the taxonomy archive page, the user would see checkboxes (or radio buttons, or a select menu) for the taxonomy terms. In the corresponding "taxonomy archive" ...


10

Taxonomies, as previously described are a collective noun for the following category post_tag post_format link_category custom taxonomy The first four are built-in taxonomies, while custom taxonomies are taxonomies that are manually created by the user with register_taxonomy. Custom Taxonomies can be hierarchical (like the build-in taxonomy category) or ...


3

Category, Tag, Link Category and Post Formats are built in taxonomies. From Codex Basically, a taxonomy is a way to group things together. The names for the different groupings in a taxonomy are called terms. Using groupings of animals as an example, we might call one group "birds", and another group "fish". "Fish" and "birds" are terms in our ...


2

You can use get_term_by() for this <?php $term_id = array_pop(get_sub_field('sector_selector')); $catinfo = get_term_by( 'id', $term_id, 'name_of_the_taxonomy' ); print $catinfo->slug;


0

I think you need to include the discipline variable in the custom permalink structure /%discipline%/%postname%


0

First get all the posts with the tag "LA Lakers". Then add "LA Lakers" as the new taxonomy terms for those posts. //Get all post with the tag LA Lakers $query = new WP_Query( 'tag=LA Lakers' ); //Loop through all the posts while( $query->have_posts() ) { $query->the_post(); //Set "LA Lakers" as taxonomy terms for these posts ...


1

In short: WordPress uses the term count in various places. There's even another count that it's in the options table. So as long as you are talking about the core behavior, then the recommendation is: Never ever touch the WordPress cores term counting mechanism! It's hard enough to bring it to work in some cases (manually updating term stuff in very, ...


0

As there's multiple Taxonomies, you will need to loop through all of the assigned taxonomies of that post type. get_object_taxonomies is the function which returns array of post type taxonomies. global $post; foreach ( get_object_taxonomies( $post ) as $tax_name ){ $taxonomy = get_taxonomy( $tax_name ); $label = $taxonomy->labels->name; ...


1

I think this is what you are looking for the_terms



Top 50 recent answers are included