Theme Tip 4 – Learn WordPress theme template tags

04 December 2010 comment icon0 | Categories: 24ways

04

If you’re going to be spending any amount of time at all hacking around a WordPress theme, there’s one thing you’re going to want to get to know really quickly that will make your life so much easier. Template tags are basically the building blocks of WordPress themes.

What are template tags?

The little bad boys are the glue between your html/css and WordPress.

The humblest example of all is:

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

Nearly every WordPress theme will have that template tag.

Another tag which is almost definitely in your theme is:

<?php the_title(); ?>

But this is just scratching the surface. You probably already know what those template tags do. But did you know there are tons of these which can could save you tons of time when you started tweaking your WordPress theme to do what you want it to do.

For example:

is_category('blue-cheese')

could be used if you wanted to display a big block of blue cheese above posts that are in the blue-cheese category.

Seriously folks spend 30 minutes having a look through the WordPress Codex on template tags.

Really important stuff.

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Comments are open but no comments have been posted yet. Go ahead and post a comment and tell us what you think.

Leave a Reply

Get Adobe Flash player