WordPress Display a custom taxonomy tag cloud in your theme

If you would like to display a “tag cloud” containing all of the items in a specific,
custom taxonomy, insert the following code anywhere in your theme files:


<?php wp_tag_cloud(array('taxonomy' => 'people', 'number' => 45)); ?>


Remember to edit the “people” term to match the name of the desired taxonomy.
You may also want to edit the “number” parameter, which specifies how many tags
are to be shown. To display all tags from the “people” taxonomy, use “0”.

Query for posts using a particular custom tag
To display only posts that have a specific tag from one of your custom taxonomies,
place the following code before the loop in one of your theme files:
<?php query_posts(array(‘people’ => ‘will-smith’, ‘showposts’ => 10)); ?>
You display posts belonging to any tag from any taxonomy by simply editing the
taxonomy name, “people”, and the tag name, “will-smith”. Lastly, you can choose
to display any number of posts by editing the value “10”. Remember that this code
must be placed before the loop in order to work.

Related Posts


No comments.

Leave a Reply