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.

I want add update services when I activate my theme, how to do this ? with an hook like enable_update_services_configuration ?

Thanks in advance

share|improve this question
    
Why on earth would you want to spam update services about activating a Theme? –  Chip Bennett Mar 16 '12 at 16:40
    
Just need to automatically add some update services in addition to the basic ones on theme activation –  zagriyen Mar 17 '12 at 14:19
    
If this is a publicly distributed Theme, I would strongly recommend against putting this sort of thing in the Theme. Defining update services to be pinged is the sort of functionality that should be left to Plugins. –  Chip Bennett Mar 17 '12 at 20:31
    
Don't worry this is for personal use only. But thanks that's sounds like a great idea, i'll try doing it through the plugins rather than the theme. –  zagriyen Mar 18 '12 at 9:13
add comment

1 Answer

Themes don't currently have activation/deactivation/installation/uninstallation hooks.

Your best bet is to "fake" it somehow, perhaps with a function that only executes one time, based on a switch that gets toggled when the function executes. e.g.:

<?php
function wpse45817_theme_activation() {
    // globalize our switch
    global $wpse45817_theme_activation_switch;
    // Check to see if the switch is set
    if ( isset( $wpse45817_theme_activation_switch ) ) {
        return;
    } else {
        // EXECUTE YOUR THEME-ACTIVATION CODE HERE
        //
        //
        // Toggle Theme activation switch
        $wpse45817_theme_activation_switch = true;
    }
}
add_action( 'after_setup_theme', 'wpse45817_theme_activation' );
?>
share|improve this answer
    
Cool chip. thanks... –  Sagive SEO Mar 16 '12 at 20:18
    
Thanks @ChipBennet –  zagriyen Mar 17 '12 at 14:17
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.