Table of Contents
It is possible to add the “Terms for Current Post” output directly into your site’s PHP files.
The best approach is to use the PHP to include the shortcode inside a PHP snippet, as in this example below.
<?php echo do_shortcode("[taxopress_postterms id="1"]"); ?>
Legacy PHP Code #
There is also a legacy option allows you to make choices directly in the PHP code. This feature extends WordPress built-in function “the_tags()”. This is the basic code snippet.
<?php st_the_tags(); ?>
Here are examples of how you can customize that basic code with more details:
'before' => __('Tags: ', 'simpletags'),
'separator' => ', ',
'after' => '<br />',
'post_id' => '',
'xformat' => __('<a href="%tag_link%" title="%tag_name%" %tag_rel%>%tag_name%</a>', 'simpletags'),
'notagtext' => __('No tag for this post.', 'simpletags'),
'number' => 0
Here are all the legacy code parameters:
- before
- (string) Text to display before the actual tags are displayed. Defaults to Tags:
- separator
- (string) Text or character to display between each tag link. The default is a comma (,) between each tag.
- after
- (string) Text to display after the last tag. The default is to display nothing.
- post_id
- (integer) Specified post ID for display tag posts (outside loop by example)
- xformat
- (string) Extended format of links. You can personalize the formatting of tag’s link. Available markups :
- tag_link – Replaced by the permalink of the tag
- tag_feed – Replaced by the RSS tag link
- tag_id – Replaced by the tag ID
- tag_name – Replaced by the tag’s name
- tag_name_attribute – Replaced by the tag’s name, formatted for attribute HTML
- tag_rel – Replaced by rel tag markup (creates : rel=”tag”)
- tag_technorati – Replaced by Technorati tag link
- tag_flickr – Replaced by Flickr tag link
- tag_delicious – Replaced by Del.ici.ous tag link
- (string) Extended format of links. You can personalize the formatting of tag’s link. Available markups :
- notagtext
- (string) Text to show, if there is no tag.
- number
- (integer) Limit tags output with this max number