Displaying Custom Taxonomy without a hyperlink

Use get_the_terms instead of the_terms. http://codex.wordpress.org/Function_Reference/get_the_terms Something like this should do the trick: $terms = get_the_terms( get_the_ID(), ‘ehp_volumes’ ); $term_count = count( $terms ); if ( $term_count > 0 && ! wp_error( $terms ) ) { $terms = array_values( $terms ); // reset keys for easier looping. by default the key matches the term id … Read more

WP_query – Filter by tax_query and meta_query using multiple select

My initial code did not provide default WP_query argument parameters if either Select option was not set – the empty Parameter would filter everything out. To the best of my ability, I applied default parameter values from the initial Post and Terms queries and now the select filter is working. I would be pleased to … Read more

How to customize taxonomy archive template files for subterms?

Strictly speaking, according to the Template Hierarchy, you cannot. Unfortunately taxonomy-$taxonomy-$term-$subterm.php is not provided for in default, so this file structure will not work. The best you can do here is taxonomy-$taxonomy-$term.php So for Thailand you will name your template as follows taxonomy-location-Thailand.php EDIT Just to add to my answer, the file structure that you … Read more

Forcing a term/taxonomy on all posts of CPT

Try this: function custom_set_term_to_post(){ $args = array( ‘post_type’ => ‘post’, ); $all_posts = get_posts(); foreach ($all_posts as $key => $post) { $tag_name=”post_tag”; // required tag name $term_list = wp_get_post_terms($post->ID, $tag_name, array(“fields” => “ids”)); if (!empty($term_list)) { // there is already tags; need not do anything continue; } $tag = array( 23 ); // required tag … Read more

Add term list as class

If you use return then your loop will not work properly. You can try the code this way: <?php while($portfolio->have_posts()) : $portfolio->the_post(); ?> <?php $term_class=””; $categories = get_the_terms($post->ID, ‘project_type’); foreach($categories as $category){ $term_class .= ‘ ‘ . $category->name; } ?> <div class=”portfolio-tile <?php echo trim($term_class) ;?>”> <?php the_post_thumbnail(‘medium’ ); ?> </div> <?php endwhile; ?> </div> … Read more