Support » Themes and Templates » 2010 Child Themes and file Includes

  • I am working on a 2010 Magazine theme, I use a lot of include files, I started to go down the route of using a child theme but gave up.

    I was getting an eror message when using the file include() with the path get_bloginfo() stylesheet directory, I cannot use TEMPLTEPATH as the path would look in the TwentyTen folder.

    I did google the error message and the answer is to edit the php ini, but that is not possible on shared hosting, is there a way around this, including a file from the child folder without using a url?

    I have worked it with a copy of 2010 and edited the theme, but I really wanted to use a child theme as it sems a better solution.


    Here is the Magazine Theme still a work in progress

Viewing 3 replies - 1 through 3 (of 3 total)
  • I thought I had this fixed with:
    locate_template( array( ‘/includes/my-custom-file-1.php’ ), true );

    This worked but when I added a second call:
    locate_template( array( ‘/includes/my-custom-file-1.php’ ), true );
    locate_template( array( ‘/includes/my-custom-file-2.php’ ), true );

    Only the first file loaded as WordPress could not find a function from file 2? 🙁

    Anyone have an answer?


    I found the answer in a child theme, just incase anyone else is starting with child themes.

    Lets say you have a modified parent theme and some Include file in the parent themes sub folders and some in the child theme.

    Parent Paths use:
    $fileurl = bloginfo( ‘template_directory’ ) .’/includes/my-file.php’;
    $filepath = TEMPLATEPATH .’/includes/my-file.php’;

    Child Theme Paths use:
    $fileurl = bloginfo( ‘stylesheet_directory’ ) .’/includes/my-file.php’;
    $filepath = STYLESHEETPATH .’/includes/my-file.php’;

    David 🙂



    Forum Moderator

    maybe of interest – just found this:

    untested, it might work like this:
    <?php locate_template(array('/includes/my-file.php'),true); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘2010 Child Themes and file Includes’ is closed to new replies.