Top 5 Useful WordPress Template Tags

<?php echo get_permalink(00); ?>

It’s good practice to use this code rather than hard coding links. If you hard code links ( then change permalinks for whatever reason (, you have to go back and recode every link manually. Using get_permalink(); is the solution. It keeps track of the Page/Post ID. To find out the id of a Page or Post, hover over the page/post and it should be visible in the status bar. Otherwise edit the page/post and you’ll see it in the url (

<?php echo get_category_link('00'); ?>

Same function as get_permalink() for cetegories. Make sure to use apostrophes around the ID. The wordpress codex has a complex method to achieve the same result instead.

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

Good to use in anything that links to your homepage such as your Header logo.

<a href="<?php bloginfo('url'); ?>">Homepage Link</a>

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

A great way to link to any images in your template directory.

<img src="<?php bloginfo('template_directory'); ?>/images/logo.gif" />

<?php if ( is_page_template( 'template-filename.php' ) ) ?>