Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

question about wordpress theme development

hi everybody

i have developed html+css template, then i try to separate it into header.php, footer.php .......index.php as usual, but suddenly i remember that the header.php footer.php 's content need to custom (that means need to be amend , i don't know if it is right to make it into pages/posts), i am little bit confusing in using pages/ posts for content, what method can i take to make those become custom content.Thank you.

3 Answers

John Locke
John Locke
15,479 Points

Priscilla,

If I understand you correctly, you want to create custom headers and footers for specific Pages or Posts. You will need to do two things.

First, for each custom header or footer, you will need to create a custom Template, and upload it with FTP. The beginning of each of these PHP files must begin with:

<?php
/* 
 * Template Name: Your Custom Header
*/
?>

Second, create your custom Page templates (if you are doing custom posts, you will have to make sure your theme supports Custom Post Types. Search the WordPress Codex for more info on this) and instead of calling

<?php get header(); ?>

Call your custom header/ footer/ whatever using this:

<?php include(TEMPLATEPATH.'/header-custom.php'); ?>

Once you upload everything to your server, you can edit them through the normal WordPress interface.

When you create your new Pages, under the drop-down menu that lets you select the type of Page Template to apply to the page, select your Custom Page that calls your custom header or footer.

Hope this helps.

very nice help , john,thank you so much, btw, do you have skype so that i can ask your professional help when u are free.

John Locke
John Locke
15,479 Points

I'm on Skype as johnj.locke