Site logo

Archived topic

Child theme javascript and include files

3 replies · Started by Anonymous on November 30, 2015

Viewing posts 1–4 of 4

Hello,

We have created Generate Press child theme. Included in this theme is a js and inc folder for functionality. The inc folder hosts a customised template tags php file. However, this doesn't flow through to the theme. Instead the customised template tags file has to be included in the parent theme, which gets over-written on theme update. How should we handle this type of customisation?

Hi Sally,

Instead of doing it that way (and potentially missing out on anything I add to the template-tags.php file in the future), look for the functions you want to alter.

If they're wrapped in a function_exists tag like this:

if ( ! function_exists( 'function_name' ) ) :
function function_name()
{

}
endif;

It means I've made it so you can overwrite that function.

Simply copy the function (and ! function_exists tag) into your functions.php file and make your changes, and it will overwrite the theme's function.

Hope this helps :)

Hi Tom,

Thanks for this! Will give it a go. Awesome theme. Really looking forward to our in-house launch. :)

No problem! Glad you're enjoying it :)

This archived topic is closed to new replies.