ThemeShaper Forums » Thematic


Problem including external files into templates?

(3 posts)
  • Started 10 years ago by jfacemyer
  • Latest reply from jfacemyer
  • This topic is resolved


  1. jfacemyer

    I've created a common-header.php and common-footer.php file for including in each of my template pages (so that I don't have to change them all when I want to edit the basic theme structure, and the templates are much easier to edit, etc).

    Is there any problem with including files like this:



    // action hook for placing content above the index loop

    // action hook creating the index loop

    // action hook for placing content below the index loop



    Or is there a better way to do this? I ask because, it's such a great way to simplify the code (if it's valid) that I'm surprised it's not done already by default.


    Posted 10 years ago #
  2. I don't think there's a problem doing it that way, I'm doing pretty much the same thing, but instead of hard-coding the template files, i'm adding my additions via functions.php. Here's a rough example:

    //add stuff below header
    function childtheme_common_header() {
    	if (is_page_template('front-page.php') ) {
    		    include "common-header.php";
    	add_action('thematic_belowheader' , 'childtheme_common_header',2);
    Posted 10 years ago #
  3. jfacemyer


    Just wondering: is there a reason you're doing it via functions.php? It seems like a lot more hassle (unless you plan on changing the names of the php files a lot, or are adding multiple php includes which may be changing).

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.