WordPress.org

Ready to get started?Download WordPress

Forums

Basic Child-theme question (5 posts)

  1. photoman856
    Member
    Posted 3 years ago #

    When a mod is done to a single .php file which is located like say:
    maintheme->includes->file.php
    or worse:
    maintheme->includes->directory->file.php

    Do I need to copy the entire ..includes directory in my child theme directory?

    OR can I just have an includes directory (to preserve the path?) and have only the file I want to mod. My first feeling is that this might confuse WP into thinking the includes folder ONLY contained that one file.

    OR - can i just put the file.php in my child theme function.php and WP will magically find it?

    And including the entire include directory seems... heavy-handed.

    =Alan R.

  2. Lisa Sabin-Wilson
    Member
    Posted 3 years ago #

    You have to follow the directory structure of the Parent theme, in the child theme folder.

    So, if your Parent theme structure is:

    /parent-theme/includes/single.php

    Then, to replace the single.php with your own modified version, in the child theme folder, you must create:

    /child-theme/includes/single.php

    Once you do that, WordPress will pickup and use YOUR single.php and ignore the single.php in the Parent theme.

    Hope that helps.

  3. photoman856
    Member
    Posted 3 years ago #

    Lisa - Thanks so much!

    So one last confirmation: Even though the nested includes folder contains many files, I just have to replicate the PATH and the files I want to monkey with... Right? Makes more sense that way - would be a shame to have to do the entire folder.

    =Alan R.

  4. Lisa Sabin-Wilson
    Member
    Posted 3 years ago #

    You are correct :)

  5. photoman856
    Member
    Posted 3 years ago #

    Awesome! Tks again...

Topic Closed

This topic has been closed to new replies.

About this Topic