Support » Themes and Templates » Child theme directory structure

  • If I mimic a parent’s directory structure in the child theme, do all the files override the parent or just css and page template files? I’m finding they don’t.

    themes/theme1-child/style.css OVERRIDES
    themes/theme1-child/pagetemplate.php OVERRIDES
    themes/theme1-child/lib/file1.php DOESN’T OVERRIDE

Viewing 4 replies - 1 through 4 (of 4 total)
  • Usually it just over rides the css and template files. To change other files I believe you need to just point towards the file you want to override it in the functions or the page that references it.

    missybunnie is correct. WordPress only overrides items from the Template Hierarchy (to the best of my knowledge).

    Thank you both. Very helpful.
    I added this to the child functions file:
    require( get_stylesheet_directory() . '/inc/lib-content.php' );
    Seems to work – is that the best way to do it?

    That seems adequate to me. I’ve not tried to override files that aren’t in the Template Hierarchy before so I honestly don’t know what the alternative would be.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Child theme directory structure’ is closed to new replies.