Add Customized Files “/Includes” Folder to WordPress Child Theme 1

I recently updated my SystemSpecialist.NET Blog theme and of course lost some modifications I made to the theme, because they where overwritten. Since I had my notes about the modifications I didn’t worry too much, but also wanted to fix this for the future. I’m not a WordPress hero, so I went Googling for some answers.

The answer was simple. I had to create a WordPress Child Theme (http://codex.wordpress.org/Child_Themes). The concept is simple because every file found in the Child Theme overrules the file in the Parent Theme. But for some reason I wrestled with the /includes/ folder. I have a customized function in one of the theme’s php files, but it wouldn’t activate. I found out that I was not the only one having this problem, although the WordPress Codex does give the answer, but not obvious enough for layman like me.

To activate my custom function, I had to create a “functions.php” in my Child Theme with the following code:

<?php
/* include customized files in include folder */
require_once( get_stylesheet_directory(). '/includes/customizedfile.php' );

Now my customized file is loaded before the original file in the Parent Theme and so is my custom function.

UPDATE: If your menu has disappeared after enabling the Child Theme, you just have to go to “Appearance > Menus” and activate the menu again.

One comment on “Add Customized Files “/Includes” Folder to WordPress Child Theme

  1. Reply TC Mar 13,2018 04:26

    Thanks! this was a lifesaver. Was pulling out my hair trying to get a simple widget edit to work.

Leave a Reply

  

  

  

*