I have a wordpress setup that I use for clients with around 30 or so child themes that they can choose from. Each child theme has it’s own functions.php file currently. Is it possible to setup just one child functions.php and call it from all the separate child themes? My reason for wanting this functionality is I find myself continually making changes to the functions.php and I have to do it to all 30+ themes every time.

4 Answers
4

Well, I’d say that you need a custom plugin. All the rationale is in this Q&A:

Where to put my code: plugin or functions.php?

Also related:

  • Where do I put the code snippets I found here or somewhere else on the web?
  • Create a Functionality Plugin Instead of Using Functions.php

And answering to the Question, create the following file /wp-content/themes/common-functions.php, and paste what you need in it. And inside the child theme functions.php use:

require_once ( TEMPLATEPATH . '/../common-functions.php' ); 

or

require_once ( WP_CONTENT_DIR . '/themes/common-functions.php' ); 

Leave a Reply

Your email address will not be published. Required fields are marked *