Set unique term_id from custom meta keys

The last (fourth) argument that you pass to wp_set_object_terms() is true, which, “If true, tags will be appended to the object. If false, tags will replace existing tags”. It sounds as though you are instructing wp_set_object_terms() to do, if I understand you, exactly what you don’t want it to do. I think that you need … Read more

Exclude categories by ID

You could try modifying your query such that you have an array of categories to exclude and a conditional in the foreach, working similarly to the !empty(). An untested example: <!– category list with thumbs –> <?php $terms = apply_filters( ‘taxonomy-images-get-terms’, ”, array(‘taxonomy’ => ‘category’) ); $exclude = array(1,7); //add the category IDs to exlcude … Read more

Hide echo of no categories from get_object_taxonomies

I believe that what you want is show_option_none show_option_none (string) Set the text to show when no categories are listed. Defaults to “No categories”. http://codex.wordpress.org/Template_Tags/wp_list_categories#Parameters Proof of concept: $args = array(‘include’=>123,’show_option_none’=> ”); wp_list_categories( $args );

Order terms by count – missing terms

By default hide_empty is true for get_terms. So i guess you must be missing terms which do not have posts. Try this, <?php $terms = get_terms(“autorzy”, array(‘orderby’ => ‘count’, ‘order’ => ‘DESC’,’hide_empty’=>0 )); $count = count($terms); if ( $count > 0 ){ echo “<div>”; foreach ( $terms as $term ) { ?> <?php echo $term->name; … Read more

How to list Custom Taxonomy

Something like this should do the job: <?php $terms = get_terms(‘YOUR-TAXONOMY’); if ( $terms ) : ?> <ul id=”portfolioFilter”> <li class=”filter” data-filter=”all”>All</li> <?php foreach ( $terms as $term ): ?> <li class=”filter” data-filter=”<?php echo $term->slug; ?>”><?php echo esc_html($term->name); ?></li> <?php endforeach; ?> </ul> <?php endif; ?>

How to get this value inside RETURN

This is more of a PHP question then a WordPress one but the answer is simple, just use PHP’s output buffer by wrapping the first code snippet eg: //create a function for the filters function get_filters(){ $terms = get_terms(‘YOUR-TAXONOMY’); if ( $terms ) { ob_start(); ?> <ul id=”portfolioFilter”> <li class=”filter” data-filter=”all”>All</li> <?php foreach ( $terms … Read more