I implemented a tag cloud into my site just to find out that it didn’t display any of my portfolio items within the tag archive which are the main content of the site. After much searching I found a very useless support thread by a professional theme designer with a nice snippet of code to enable custom post types within the tag archive.

Simply add the following code to the bottom of your functions.php

Code from ‘Dude’ at Kriesi.at. Make sure you include nav_menu_item or you’ll break any navigation on the same page.

If you’d like to learn further about how the add_filter function works you can do so over at the WordPress function reference site.

Once I had done this I had all of my portfolio posts displaying in the tag archive, just they didn’t have any excerpt text. After investigating further I found that these posts for some reason had no excerpt text applied yet I was still able to access all their content. I wrote a custom excerpt function which manipulates the content rather then the excerpt generated by WordPress. I had to manually rip out title tags, it will automatically rip out any h1-h6. Simply add the following code to your functions.php

Then you just need to update your archive.php/tag.php (depending on what sort of template you’re using) and replace the current excerpt function with:

Replacing 50 with the number of characters you wish to display!

Now you should have a fully functioning tag archive page complete with excerpts.

Dave Macaulay
Dave Macaulay
I'm an enthusiastic, slightly eccentric Magento developer who bores with the idea of another basic brief.