This topic has 2 replies, 2 voices, and was last updated 12 years, 1 month ago by Fem.
Tagged: child theme
Viewing 3 posts - 1 through 3 (of 3 total)
I’m trying to make some changes to template files (e.g., /framework/shortcode/foodmenu.php) in the child theme, but because they’re more than 1 subdirectory below the main theme directory, they are not automatically loaded by WP.
Any suggestions on how to override parent template files? I’ve been messing around with hooks and trying to figure out how to override the atp_shortcodes function in my child functions.php file (for the file above), but I haven’t had any luck.
I did notice that in the parent functions.php file it mentions that it sets the file path based on whether the options framework is in a parent or child theme (starting line 95), but that doesn’t actually seem to be the case – it always returns the template directory, not the stylesheet directory (which would be the child theme). And copying the entire framework directory over to my child theme (and modifying the parent functions.php file to use the stylesheet directory as the path) seems to really defeat the purpose of being able to make tweaks to just a couple of framework files.
We will look into the problem and see if that can be possible to make the things work out with the child themes if you need to alter the files from the parent theme.
Meanwhile you can get it resolved from this http://codex.wordpress.org/Child_Themes#Referencing_.2F_Including_Files_in_Your_Child_Theme
Open the functions.php file in the child theme and then add the following code as shown below and then place the shortcode file according to your requirement in sub directory and make sure you set the correct path in the functions.php
require_once ( get_stylesheet_directory() . '/framework/shortcode/foodmenu.php');
After that in the parent theme and in the child theme shortcodes which you wish customize you need to wrap the code in as shown below as it has to be nested within the compaitbility function for child theme supports.
if(!function_exists('menutype_menuspecial')){
function menutype_menuspecial ($atts, $content = null,$code)
.....
.....
}
}
If you get confused or stuck at altering the code then please feel free to contact us via Skype and we will be there to assist you for adding this shortcode…
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.