Feature request
-
Hi Shazzad,
I came across a situation where I needed to output the term name to a class so I could use css to display none, but doing a terms + post list was not what I wanted (pagination didn’t work, and I really just wanted to sort by post). I tried the [post_terms] shortcode, but it just makes a call to wordpress’s get_the_term_list() function which returns a html link. So I added some code to the post_terms function in the your helper-posts.php file (see below):
public static function post_terms($attr, $cont) { if( isset($attr['tax']) ){ $taxonomy = $attr['tax']; } elseif( isset($attr['taxonomy']) ){ $taxonomy = $attr['taxonomy']; } if( ! isset($taxonomy) || ! taxonomy_exists($taxonomy) ) return; $sep = ', '; if( isset($attr['sep']) ){ $sep = $attr['sep']; } //New code if (isset($attr['nolink']) && $attr['nolink'] == "true"){ $term_string = ""; $terms = get_the_terms( get_the_ID(), $taxonomy ); foreach ($terms as $term){ $term_string .= $term->slug . " "; } return $term_string; } //end new code else return get_the_term_list( get_the_ID(), $taxonomy, '', $sep ); }
And I call it with the following shortcode:
[post_terms tax=”category” nolink=”true”]
Is it possible for you to add this code to a future update so I don’t have to keep adding it when you update?
Thanks,
Adrian
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Feature request’ is closed to new replies.