Tagged: child theme
-
AuthorPosts
-
July 15, 2014 at 7:12 am #291418
Hello, there!
How to edit files using child theme? For example, I want to edit class-breadcrumb.php in enfold/framework/php folder. So I created enfold-child/framework/php/class-breadcrumb.php file and tried to change just a title of Home page. But nothing happens.
Am I doing something wrong?
July 15, 2014 at 7:53 am #291427Hi srs6270!
Thank you for using the theme.
Why exactly do you want to edit the breadcrumbs? If I am not mistaken, the avia framework can only be modified using filters on the child theme functions.php. If you can tell us why you need to edit the breadcrumbs, maybe we can help. If you want to alter the avia shortcodes using a child theme, add this on functions.php:
add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1); function avia_include_shortcode_template($paths) { $template_url = get_stylesheet_directory(); array_unshift($paths, $template_url.'/shortcodes/'); return $paths; }
Create a shortcode folder then copy the element or shortcode that you want to edit from config-templatebuilder > avia-shortcodes folder. Place it on the child theme’s shortcode folder. I’ll ask Dude to check, maybe my answer is insufficient.
Best regards,
IsmaelJuly 15, 2014 at 7:57 am #291428Hey, Ismael!
Thanks for the fast reply)
Title of the first page called “Home” is static. And my web-site will be for russian speakers.
I edited the title before, but after updating changes gone. So I want to do it with child theme and WITHOUT any external plugins.July 15, 2014 at 10:00 am #291467Hi!
Thanks for your update.
If you want to alter class-breadcrumb.php in a child theme, follow the following steps:
1) Copy the original file into a subfolder of the child theme, lets call this folder my_files
2) From this file remove// At beginning of file line 3 + 4 remove: if(!class_exists('avia_breadcrumb')) { and aat line 144 remove: }
Delete all after line 144 (these files are currently not ready to be hooked by the child theme)
3) Make your changes to this class
4) In functions.php of the child theme put the following:
require_once ('/my_files/class-breadcrumb.php');
If you need to do some changes in the other functions you can look for apply_filters
// Example in line 510 $breadcrumb = apply_filters( 'avia_breadcrumbs', $breadcrumb );
In functions.php of the child theme then put the following:
add_filter('avia_breadcrumbs', 'my_breadcrumbs', 10, 1); function my_breadcrumbs($breadcrumb ) { // do something with breadcrumb return $breadcrumb; }
Hope, this will help you.
Cheers!
Günter- This reply was modified 10 years, 4 months ago by Günter.
July 15, 2014 at 10:07 am #291471Thanks a lot! I’ll try to do this!
July 15, 2014 at 4:41 pm #291682Hi!
Great, please let us know if it doesn’t work.
Best regards,
Peter -
AuthorPosts
- The topic ‘Editing files using child theme?’ is closed to new replies.