1

I created a child theme and i want to edit a php file. So i copy and paste the php file into the child's theme folder and then i edit it. But it seems that nothing changed in the site preview! In the theme's folder there is a subfolder named "templates". There it is the "slider.php". Before creating the child theme, i tried to edit the parent theme and i made the same changes i made in the cherry and it was correct. I want to make some little changes in some php files but i can't!

I think i find the start of my problem but i really can't understand it. In the WordPress documentation in the Child Theme section, in the "Other Files" paragraph it says: "if this file (slider.php) is not included by any of your template files or functions.php file then you can not override this file by your child theme."

I first try creating the "functions.php" and then inserting this code:

<?php require_once( get_stylesheet_directory(). 'templates/slider.php' ); ?>

But after uploading the "functions.php" in the child theme an error occured.

I am really confused about this!

What is the way to edit a php file in a child theme?

  • that seems to be the correct way. you duplicate the php template file into the child theme and edit it. – Michael Apr 11 '13 at 14:55
  • That's what i did but nothing changed! Do i have to do something else from copy-paste-edit-save? – Charitos Apr 11 '13 at 15:11
  • Are you sure you're editing the correct template? See codex.wordpress.org/Template_Hierarchy – Duane Apr 11 '13 at 15:50
  • @Duane, I am sure that i am editing the correct template. In the theme's folder there is a subfolder named "templates". There it is the "slider.php". Before creating the child theme, i tried to edit the parent theme and i made the same changes i made in the cherry and it was correct. I want to make some little changes in some php files but i can't! P.S. I use the "Cherry Theme" link – Charitos Apr 11 '13 at 16:49
  • @brasofilo I can't understand what you want me to clarify! It is a slider in the main page (index). – Charitos Apr 11 '13 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.