function layerslider_activation_scripts() { // Multi-site if (is_multisite()) { // Get WPDB Object global $wpdb; // Get current site $old_site = $wpdb->blogid; // Get all sites $sites = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}"); // Iterate over the sites foreach ($sites as $site) { switch_to_blog($site); layerslider_create_db_table(); } // Switch back the old site switch_to_blog($old_site); // Single-site } else { layerslider_create_db_table(); } // Call "activated" hook if (has_action('layerslider_activated')) { do_action('layerslider_activated'); } // Check new install layerslider_install_scripts(); // Redirect to LS's admin page after activation update_option('layerslider_do_activation_redirect', 1); }
function layerslider_update_scripts() { // Check new install layerslider_install_scripts(); if (has_action('layerslider_updated')) { do_action('layerslider_updated'); } }