Support » Fixing WordPress » Child theme – how to call a .php file in a subfolder?

  • I understand how to call the style.css in my child theme

    /*
    Theme Name: suffusion-child
    Description: Child theme for the suffusion theme
    Author: Jamie Furlong
    Template: suffusion
    */
    
    @import url("../suffusion/style.css");

    And I understand that my child theme functions.php is appended to the main functions.php file.

    But how do I call the file ‘post-header.php’ which sits in a subfolder called ‘custom’ in my child-theme?

    I have read this article and am unsure if I am supposed to add require_once( get_stylesheet_directory(). '/custom/post-header.php' ); to my child functions.php. I have tried this already but nothing has changed.

    I know this is a simple problem, but what’s the solution?

Viewing 4 replies - 1 through 4 (of 4 total)
  • @demonboy Have U figured out a solution? I am in a similar problem. How can we edit/modify a file in the sub directory for a child theme.

    Even if we mirror the same folder structure the modifications done in a file in a sub directory doesnt reflect?

    Any help will be highly appreciated

    Thanks in Advance

    @maruti – per the forum guidelines, please start your own thread. It’s unlikely you have the identical situation as the OP and it works better for people here to only help one person at a time. Including a link to your site will also help people help you.

    The paths need to be the same in the child theme as they are in parent theme. For example, you have post-header.php. You need to duplicate it’s path in the child theme. So, if it’s directory path is /suffusion/custom/post-header.php, you can override it by creating a custom directory in your child theme: suffusion-child/custom/post-header.php.

    @wpyogi .. Yeah I understand that, but what I see is no thread related to this issue has been solved, So I was trying to know if the concerned person has found a tweak or so.
    Regarding the link to the site, I dont think this is required as this is a problem which can easily be visualised.

    @andrew Thanks for replying … But this is exactly I have tried. But the files in the sub-directories in the child theme doesnt seem to get override. Cause I tried by simply replacing a text and it doesnt work.
    Have u really made it work this way?

    Any more inputs will help…
    Thanks for replying … looking for some help

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Child theme – how to call a .php file in a subfolder?’ is closed to new replies.