Difference between revisions of "WordPress Template Tag"
From Wiki @ Karl Jones dot com
Karl Jones (Talk | contribs) |
Karl Jones (Talk | contribs) |
||
Line 19: | Line 19: | ||
Conditional template tags test for specific conditions. | Conditional template tags test for specific conditions. | ||
− | Example, the [[WordPress is_archive | + | Example, the [[WordPress is_archive function|is_archive]] function: |
<pre> | <pre> |
Revision as of 17:59, 25 October 2016
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 ... } ?>