WordPress Template Tag

From Wiki @ Karl Jones dot com
Jump to: navigation, search

In WordPress, Template Tags are a type of WordPress function, used in WordPress Templates to display information, test conditions, etc.

Example: bloginfo()

The code below displays the name of the blog:

<?php bloginfo('name'); ?>

It is often used in the header.php file, along with HTML, like this:

<h1><?php bloginfo('name'); ?></h1>

Conditional tags

Conditional template tags test for specific conditions.

Example, the is_archive function:

<?php
if ( is_archive() ) {
    // write your code here ...
}
?>

See also

External links