Glossary with Custom Post Type

$index = 0; $terms = get_terms(‘marke’); $range = array_merge(range(0, 9), range(‘A’, ‘Z’)); echo ‘<ul>’; foreach ($terms as $term) { if(ord($range[$index]) <= ord(strtoupper(substr($term->name, 0, 1)))) { while($range[$index] != strtoupper(substr($term->name, 0, 1))) { echo ‘<li>’. $range[$index] . ‘</li>’; $index++; } $index = strtoupper(substr($term->name, 0, 1)); echo “<li><a href=””.get_term_link($term).”” />{$range[$index]}</a></li>”; $index++; } }

Retrieving custom taxonomy in order, but excluding specific tax IDs

Alas no answers or comments! 😛 Not to worry, a colleague helped me out here and here is the above code working with an $exclude function terms_by_order($taxonomy, $exclude) { global $post; $terms = get_the_terms($post->ID, $taxonomy); // check input if ( empty($terms) || is_wp_error($terms) || !is_array($terms) ) return; // exclude foreach ($terms as $key=>$term) { if … Read more

How to find objects by terms

Assuming “users” you are trying to pull is a custom post type. You can use “tax_query” as below. $user_args = array( ‘post_type’ => ‘custom_user_post’, // Custom post type, ‘posts_per_page’ => 10, ‘paged’ => ( ! empty( get_query_var( ‘paged’ ) )? get_query_var(‘paged’): 1 ), ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘user_sports’, //assuming your … Read more

display multiple term post from taxonomy in a single page

Thank you for your time answering my unclear question. The code I found is the one that Im looking for. Thank you again 🙂 <?php //http://codex.wordpress.org/Function_Reference/WP_Query#Taxonomy_Parameters $term_slug = get_queried_object()->slug; if ( !$term_slug ) return; else $args = array( ‘tax_query’ => array( array( ‘taxonomy’ => ‘gallery_category’, ‘field’ => ‘slug’, ‘terms’ => $term_slug, ‘posts_per_page’ => 10 ) … Read more

Search Terms – Querying on either description__like OR name__like in the same Term Query?

I don’t see any options for WordPress to search terms by both of name & description. So i combined 2 queries like @StephanieQ but maybe more simple way, checkout my ajax response below: public function ajax_project_terms_search() { $results = array(); $search_query = sanitize_text_field($_GET[‘q’]); $withname = intval($_GET[‘withname’]); $search_keys = array(‘name__like’, ‘description__like’); $exclude = array(); foreach ($search_keys … Read more

How to hook get_terms() to only show count of posts that have custom meta

As far as I remember counts for terms are stored in database, so there is nothing to modify when you fetch them – you simply get ready-made numbers. So you will either need to implement and maintain your special logic for counts completely separately or try to recalculate and modify native counts, see wp_update_term_count_now().