mardi 3 mars 2015

Exclude Tags by Array


and thanks for any help!.


I'm trying to display all of the tags except ones that start with a token ("Author: ").


I have figured out how to exclude a single tag (just typed it into the exclude parameter).


I have figured out how to exclude an array of tags (created an array and manually added a couple of values).


But I haven't figured out how to fill the array based on get_term_by (or whether or not that is the best way to approach this).



<div id="tagarea">
<div class="contained">
<h2>Categories</h2><br>
<?php
//$excludetags = array(136,135);
$excludetags = get_term_by('name', 'Author:*','post_tag');
$args = array(
'separator' => " ... ",
'orderby' => 'name',
'order' => 'ASC',
'exclude' => $excludetags,
'include' => null,
'topic_count_text_callback' => default_topic_count_text,
'link' => 'view',
'taxonomy' => 'post_tag',
'echo' => true,
'child_of' => null, // see Note!
);
?>
<?php wp_tag_cloud( $args ); ?>
</div>


I also tried



$excludetags = array(get_term_by('name', 'Author:*','post_tag'));


but that doesn't work, either.





Aucun commentaire:

Enregistrer un commentaire