Child theme php file referencing- how do I exactly?
-
Hello,
My limited understanding of php prevents me from knowing where and how and where to use code in order to reference additional files ( to the css) in my child theme.
My theme has altered feature, home, and sidebar php files. So I understand that I should put those altered files in my child folder and references them? But exactly how please and thanks?
https://www.justonetree.org/
https://b4c.1ca.myftpupload.com/ (staging url)Referencing / Including Files in Your Child Theme
When you need to include files that reside within your child theme’s directory structure, you will use get_stylesheet_directory(). Because the parent template’s style.css is replaced by your child theme’s style.css, and your style.css resides in the root of your child theme’s subdirectory, get_stylesheet_directory() points to your child theme’s directory (not the parent theme’s directory).Here’s an example, using require_once, that shows how you can use get_stylesheet_directory when referencing a file stored within your child theme’s directory structure.
require_once( get_stylesheet_directory() . ‘/my_included_file.php’ );
- The topic ‘Child theme php file referencing- how do I exactly?’ is closed to new replies.