12 Useful WordPress Template Tags

WordPress template tags give you more ways to control how content displays on your website. Here are twelve useful template tags and how to use them when you create a WordPress theme.


These template tags are either very common, helpful or fun. The table lists the tags, their locations in the templates where they're commonly used, and their purposes.









































Tags Used in the Comments Template (class="code">comments.php)
TagFunction
<?php comment_author(); ?>Displays the comment author’s name.
<?php comment_author_link(); ?>Displays the comment author’s name, linked to the
author’s Web site if a URL was provided in the comment
form.
<?php comment_text(); ?>Displays the text of a comment.
<?php comment_date() ?>Displays the date when a comment was published.
<?php comment_time(); ?>Displays the time when a comment was published.
<?php echo get_avatar(); ?>Displays the gravatar (globally recognized avatar) of the
comment author.
<?php previous_comments_link() ?>Displays navigation links to the previous page of comments (if
you’re using paged comments).
<?php next_comments_link() ?>Displays navigation links to the next page of comments (if
you’re using paged comments).
















Tags Used to Display RSS Feeds
TagFunction
<?php bloginfo('rss2_url'); ?>Displays the URL of the RSS feed for your site. Usually
surrounded by the a href HTML tag to provide a hyperlink to the RSS
feed:

<a href="
<?php bloginfo('rss2_url'); ?>class="code">">RSS Feedclass="code"></a>.
<?php bloginfo('comments_rss2_url'); ?>Displays the URL of the RSS feed for your comments. Usually
surrounded by the a href HTML tag to provide a hyperlink to the
comments RSS feed:

<a href="
="<?php bloginfo('comments_rss2_url');
?>">
Comments RSSclass="code"></a>.
















Tags Used to Display Author Information
TagFunction
<?php the_author_description(); ?>Pulls the information from the author bio located in the About
Yourself section of the author profile in the Dashboard and
displays that information.
<?php the_author_email(); ?>Pulls the author's e-mail address from the author profile in
the Dashboard.

The WordPress Codex page has every conceivable template tag and possible parameters known to the WordPress software. The tags and parameters here are the ones used most often.




dummies

Source:http://www.dummies.com/how-to/content/12-useful-wordpress-template-tags.html

No comments:

Post a Comment