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'd like to use the excellent Zoninator plugin with my theme, making it a required plugin using the TGM Plugin Activation Class. On activation of the plugin I want to create one or more zones programmatically. Can anyone tell me how to

  • Set a listener in my theme which performs a function when a particular plugin is activated
  • Create a specific Zoninator zone in that function, if it doesn't already exist?

For the first part I've tried this in my functions.php:

register_activation_hook( plugins_url('zoninator/zoninator.php', __FILE__), 'myplugin_activate' );

function myplugin_activate() {
    //
}

But nothing happens when I activate Zoninator.

For the second part I've tried calling z_get_zones() to see what Zoninator zones already exist. But I get warnings like "Attempt to assign property of non-object in [..]\wordpress\wp-content\plugins\zoninator\zoninator.php on line 1129", and a WP error object that reports "Invalid taxonomy".

Thanks guys!

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

As advised by the Zoninator developer Mohammad Jangda, you can solve the second part of this problem like this:

    if (z_get_zone(‘home’) == ”) {
        global $zoninator;
        $zoninator->insert_zone( ‘home’, ‘Home’, array(‘description’ => ‘This is the Home Zone programmatically inserted’));
}
share|improve this answer
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.