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.

So I have been building a child theme for a site. Wanted to add post formats to a twentyten child theme. Now, the goal of my child theme is to copy over the absolute least amount of code/templates from the parent as possible.

I originally figured if I added additional post formats to a twentyten child theme, using a custom function which uses add_action after_setup_theme, it would work. However, that does nothing. Something like (either with or without the 2 existing formats, doesn't matter):

function voodoochild_setup(){

add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link' ) );
}

add_action( 'after_setup_theme', 'voodoochild_setup' ); 

The only way I've found to add post formats, is to copy the entire twentyten_setup action to my child functions.php from twentyten, and edit that small portion from there, adding my formats.

This works fine, and I'm cool with it. I just want to know if it's necessary. Is there a better way to register new formats onto a child theme without hauling that big block of code over to the child?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Try bumping the priority of your hook, like so:

add_action( 'after_setup_theme', 'voodoochild_setup', 11 );

This will ensure that it runs after the TwentyTen formats setup, so that it gets the last laugh. That's how I do it on WordPreh.com.

share|improve this answer
    
Holy Crap, that was easy! Thanks! –  Rev. Voodoo Mar 8 '11 at 18:24
add comment

EDIT: Dougal posted the same thing whilst i was writing my response, but i'm posting mine anyway, +1 Dougal.

The parent theme formats will override the childs, and vice versa depending on which occurs first, what you can do though is hook onto after_setup_theme after the parent theme has done so and redefine them, like so..

add_action( 'after_setup_theme', 't31os_setup', 11 );
function t31os_setup(){
    add_theme_support( 'post-formats', array( 'aside', 'gallery', 'image', 'quote' ) );
}

TwentyTens setup function runs at priority 10(default), so as long as we run the above filter after that we get control over the formats.

share|improve this answer
    
Appreciate you taking the time to answer as well! Ahh... simple things eh? I've only just started figuring out the priority thing.... so I forget to use it often –  Rev. Voodoo Mar 8 '11 at 18:33
    
No problem at all, took me all of about 2 minutes to work out.. ;) –  t31os Mar 8 '11 at 18:37
    
"Dougal posted the same thing whilst i was writing my response..." Heh, happens to us all. :) –  Dougal Campbell Mar 8 '11 at 20:44
add comment

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.