Tag Info

Hot answers tagged

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 ...


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 ...


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) ...


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;


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' ...


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" ...


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 ...


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 ...


1

I think this is what you are looking for the_terms


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, ...



Only top voted, non community-wiki answers of a minimum length are eligible