Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

If I use one of the popular frameworks such as Genesis, is it possible to create grandchild themes?

As an example, I want to use Genesis as the backbone of all my sites. Genesis is called a framework but is actually a parent theme.

Then I select one of the Genesis child themes for sale at StudioPress, and want to continue customising it for each of my sites. Would I be creating a grandchild theme for all of my sites, and how would I go about it?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Yes and No.

You could create a child theme specifying another child theme as the parent, and WordPress would attempt to use it.

However

You will run into issues, not to mention that the core devs have explicitly stated that this is not desirable behaviour, and they will not make efforts to support grandchild themes.

It's also considered very bad practice. If you have a need for grandchild themes then your approach has taken a wrong turn, and you need to step back and re-evaluate things.

I would advise you avoid the concept of grandchild themes, it will lead to more problems. Instead more hooks filters actions and modularity in your child theme should enable you to keep the child themes shared components the same, and let you branch/fork with little difficulty. Try moving common elements into an svn external/git submodule.

There's also the _s model where you have your child theme as a base, and fork it, rather than having it as a parent with the intention you work on the copy, rather than a child/override.

share|improve this answer
    
So in my case if I go with Genesis I'll just have to modify the child theme directly right? Not very familiar with Git, but would be interested in an approach that helps me keep the original child theme intact. –  drtanz Sep 21 '12 at 11:53
    
Yes, you don't have a lot of options here. –  Tom J Nowell Sep 21 '12 at 12:02
    
I wonder what would happen if you tried to make a great grandchild theme. –  Chris_O Sep 22 '12 at 15:15
    
confusion, afterall things like get template vs get stylesheet only accoung for parent child, a lot of stuff in the original parent would be lost –  Tom J Nowell Sep 22 '12 at 18:14
    
Although I might not raccomand it - It might be achievable using a pseudo-theme plugin –  krembo99 Feb 27 at 5:18

I did not fully tested the method described below , Nor a normal "grandchild" theme , But giving the functionality of the template_include filter :

    /*
    Plugin Name: Grandchild Themes
    Plugin URI: http://www.who-cares.com/
    Description: A concept for Grandchild themes Plugin
    Author: See Plugin URI
    Version: 0.0.0.0.1-Alpha
    */

    add_action('wp_head', 'grnd_chld_add_headers', 0);
    add_action('init', 'grnd_chld_add_css');

    // Load template if exists. 
function grandchild_template_include( $template ) {

    if ( file_exists( untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/grnd_chld_templates/' . basename( $template ) ) )
        $template = untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/grnd_chld_templates/' . basename( $template );

    return $template;
}

// This is the actual filter that we want .
add_filter( 'template_include', 'grandchild_template_include', 11 );

    function grnd_chld_add_headers () {
        wp_enqueue_style('my_grandchild_style');
    }

    function grnd_chld_add_css() {
        $stamp = @filemtime(plugin_dir_path(__FILE__).'/style.css'); // easy versioning
        wp_register_style ('my_grandchild_style', plugins_url('style.css', __FILE__).'', array(), $stamp);
    }

    // From here , what you got is like a normal functions.php.

You can also, in a similar way , try more specific filters like for example archive_template

add_filter ('archive_template', create_function ('', 'return plugin_dir_path(__FILE__)."archive.php";'));

All that said and done , I am not sure it is the best way to do things .

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.