WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a WordPress site, it's an online newspaper site.

The theme I am developing, I want to add custom template functions like get_footer() or get_header(), so that I can save those HTML and PHP codes like the way footer.php stores.

Thanks in advance.

share|improve this question
up vote 1 down vote accepted

You can define your function in the file function.php and use it later in your theme.

share|improve this answer

In Wordpress 3.0 you can use

get_template_part($slug, $name);

This function will include file named "{slug}-{name}.php". The $name is optional, and if it's empty, the function will include file named "{slug}.php".

There is also the traditional PHP-code, but this do not check if the file exsist.

include(TEMPLATEPATH . 'template-name.php');
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.