Get Posts with matching lowest taxonomies
I was able to solve this by ordering my taxonomy values based on this post: Custom taxonomy, get_the_terms, listing in order of parent > child
I was able to solve this by ordering my taxonomy values based on this post: Custom taxonomy, get_the_terms, listing in order of parent > child
The is_tax() function checks if a custom taxonomy archive page is being displayed. So it will only work in template files such as taxonomy-product_cat.php – unless you create new templates for specific categories in the product_cat taxonomy. For example, if you have a product category called “Toasters” and the slug is “toasters” then the template … Read more
Use a taxonomy.php template?! taxonomy.php <?php get_header(); ?> <?php $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); ?> <h1><?php echo $term->name; ?></h1> <?php global $query_string; query_posts( $query_string . ‘&orderby=title&order=asc’ ); if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <h1><a href=”https://wordpress.stackexchange.com/questions/72934/<?php echo get_permalink(); ?>” title=”<?php the_title(); ?>” rel=”bookmark”><?php the_title(); ?></a></h1> <?php … Read more
You can build a list using two functions: get_terms() and get_term_link(): <?php function wpse73271_get_term_archive_link_list( $taxonomy ) { // First, get an array of term IDs $term_objects = get_terms( $taxonomy ); // Now, loop through $term_ids and get // an array of term archive permalinks foreach ( $term_objects as $term_object ) { $term_object->url = get_term_link( $term_object, … Read more
If I understood this correct, then you need a taxonomy.php file. LINK
No, it is not possible to order by taxonomy, because from a certain type of standpoint, that doesn’t actually make much sense. Taxonomies are ways to group things together. So the point of having a taxonomy on posts would really be to have terms in that taxonomy that are shared between posts. If a taxonomy … Read more
Probably something like this: $records = new WP_Query( array( ‘post_type’ => array(‘record’), ‘post_per_page’ => -1, ) ); while ( $records->have_posts() ) : $records->the_post(); $terms = wp_get_post_terms( get_the_ID(), ‘planets’ ); if ( count( $terms ) === 0 ) { echo ‘Post ID: ‘ . get_the_ID() . ‘<br />’; } endwhile; wp_reset_postdata();
Thanks every one for help, I discovered that that the problem is from my theme admin that was limiting the posts to 5 and fixed now.
I have run into similar problem with the system I am currently building – I needed ZIP codes to be children of Cities, which were to be children of States. What I have learned is that it was possible to add custom fields to the term creation form to link the term (e.g. ZIP) to … Read more
I doubt you’re going to find a function that created the exact output you’re using, so you’re probably looking at two nested called to get_terms(). I usually avoid most other taxonomy-related plugins in favor of get terms. Most of the other functions are wrappers for this one. Here’s some psuedo-code for what I’d do: <?php … Read more