WordPress Page Templates (Theme Development)

WordPress Page Templates (Theme Development)


In this lesson we learn how to use page templates and conditional logic to apply different layouts to different WP pages. Check out my “Get a Developer Job” course:

To view a complete list of the WordPress lessons in sequential order visit:

Link to download .zip of theme files as shown in this video (note: this is not a “complete” WordPress theme yet and this download is only intended for educational purposes to dissect and review):

Want to share the WordPress website that you’ve been creating on your computer with the world? Learn about the web host I use and how you can get a domain + hosting for .95 a month ( savings):

Sign up for my newsletter to receive periodic webDev tips, tricks, resources and coupons. Join the list at

Follow LearnWebCode on Twitter for resources and updates:

36 Comments

36 Replies to “WordPress Page Templates (Theme Development)”

  1. Awesome videos. I never really liked WordPress because of PHP and some bad experiences but these tutorials have opened my mind about custom theme development. I think I’ll enjoy it. Will definitely pick a WordPress based gig now.

  2. hello sir! How did you add post to other page than the index… I want to add a post to portfolio page and try what you did but any post that i create goes to index page. Please help. Thanx!

  3. So i followed the instruction with the disclaimer part but its not inside a box… any suggestions? thanks in advance.

  4. For those who are not getting the text to sit next to the title in the portfolio page, copy the below into your css file. You can see the code at 6:05.

    Would have been helpful to have mentioned this in the video!.

    /* Clearfix */
    .clearfix:before, .clearfix:after { content: “”; display: table; }
    .clearfix:after { clear: both; }
    .clearfix { *zoom: 1; }

  5. If you change the style.css file, will the changes remain after the theme is updated to a new version? Will the custom css suddenly disappear after an update?

  6. for everyone when changing permalink to month and name have 404 error on server adding this in Custom Structure
    /index.php/%year%/%monthnum%/%day%/%postname%/

  7. Great tutorial! Thanks a lot for that! But what did you do to get your Editor to give you the whole comment and div-Code just tipping in “info” and div? How did you preset this?

  8. For the first time I really understand THIS wordpress famous hierarchie.
    Your tutorials are of the best of the best.

     A big thanks to you

  9. I cant get past the two column layout, all the code appears to be right, i tripple checked all of it over and over but the right side just kind of wraps around the title it does not separate and float to the right. I dont understand what im doing wrong. Please help! I’d really appreciate it! Thanks!

  10. You are awsome instructor. The way you instruct and talk is very much directive and pointful.
    Thank you very much

  11. Thanks man! I just subscribed to your channel! You’ve been a great help! Kudos!

  12. If someone has a way to change the text in the infobox with the dashboard that will be great.

  13. Another tip: You can also use echo function inside the if else statement if you want. but for the sake of this tutorial, i did his method so that everything will no go wrong. Nice tutorial btw. Thanks!

  14. I have literally copied and pasted your code from the zip files and can’t get portfolio page to work. The content text on my portfolio page eventually begins in to leak into the left column underneath the title. Anyone have any ideas?

  15. Hey! I used SPECIAL LAYOUT Template (with INFO BOX) for a page which doesn’t have any other written content yet, other than the header. My footer menu is running through it rather than having yielded and moved to the bottom. The only info which moved to the bottom of the info box is the copyright. Any solutions? Thanks!!

  16. The disclaimer is appearing, but none of the associated class-styling (i.e. div.info-box) is appearing.

  17. hi man great vids! Do you mind telling me which code writer you use? It seems to fill out soms things on its self and look super handy cause i am typinng sooo much. Thanks man.

  18. With manual coding, I have so much trouble with CSS showing quite different results on different browsers. Does anyone know if WordPress has a built-in method to better handle this issue ? Also, is it possible to use javascript within WordPress ? Simple tests proved it doesn’t work as is.

  19. Btw for those, like me, who’s conditional page is the home page, you can simply put: if (is_home())

  20. Very nice tutorial. I have followed this series from the beginning and don’t remember where you mentioned the importance of clearfix. I encountered a problem with the footer and I didn’t know how to go about it until I read in the comment that we should include the clearfix in the CSS not just the page-portfolio.php.

  21. Is there a way to make an empty page with just 2 buttons before the site? Using filezila is to difficult

  22. Dude! You rock!!! Best tutorials I have ever seen and I’ve seen a gazillion.

  23. Your tutorials are great, I used a different CMS before trying WordPress, but I have ran into an issue.

    I am following you tutorials line for line, but WP does not seem to recognise page.php.

    The changes you go through in your tutorials are not affecting my page themes.

    Please guide me as I feel changing to WP was a good move.

  24. Great explanation of custom templates, however I have one question: Since you simply copied the main page code content used by default template, then added the ‘info box’ for the special template, what happens if you later decide to edit the default template main page content? Are you stuck editing in two places or is there a DRY method to do this? Can we use SSI (Server Side Includes) instead with WP to modularize development better?

  25. become a syntax error when I take that “if” function, please help me guys,

Comments are closed.