/**
  * Print the themes section (themes switcher) when previewing the themes from wp-admin/themes.php
  * hook : hu_remove_section_map
  */
 function hu_set_theme_switcher_visibility($_sections)
 {
     //Don't do anything is in preview frame
     //=> because once the preview is ready, a postMessage is sent to the panel frame to refresh the sections and panels
     //Do nothing if WP version under 4.2
     global $wp_version;
     if (hu_is_customize_preview_frame() || !version_compare($wp_version, '4.2', '>=')) {
         return $_sections;
     }
     //when user access the theme switcher from the admin bar
     $_theme_switcher_requested = false;
     if (isset($_GET['autofocus'])) {
         $autofocus = wp_unslash($_GET['autofocus']);
         if (is_array($autofocus) && isset($autofocus['section'])) {
             $_theme_switcher_requested = 'themes' == $autofocus['section'];
         }
     }
     if (isset($_GET['theme']) || !is_array($_sections) || $_theme_switcher_requested) {
         return $_sections;
     }
     array_push($_sections, 'themes');
     return $_sections;
 }
Пример #2
0
function hu_print_dynamic_sidebars($_id, $location)
{
    global $wp_registered_sidebars;
    $sidebars_widgets = wp_get_sidebars_widgets();
    if (!isset($wp_registered_sidebars[$_id])) {
        return;
    }
    if (hu_is_customize_preview_frame()) {
        //is there a meta setting overriding the customizer ?
        if (false != hu_get_singular_meta_widget_zone($location)) {
            printf('<div class="widget"><div class="hu-placeholder-widget"><h3>%1$s<br/><span class="zone-name">"%2$s"</span> %3$s</h3><br/><p>%4$s</p></div></div>', __('You have already assigned the following widget zone here : ', 'hueman'), $wp_registered_sidebars[$_id]['name'], __('in this post or page options.', 'hueman'), __('You can change or disable this setting by editing the options of the current post / page.', 'hueman'));
        }
        if (empty($sidebars_widgets[$_id]) || !is_array($sidebars_widgets[$_id])) {
            printf('<div class="widget"><div class="hu-placeholder-widget"><h3>%1$s<br/><span class="zone-name">"%2$s"</span></h3></div></div>', __('Add widgets to the zone :', 'hueman'), $wp_registered_sidebars[$_id]['name']);
        }
    }
    //end if customizing
    //print it
    dynamic_sidebar($_id);
}
Пример #3
0
/**
* Are we in a customization context ? => ||
* 1) Left panel ?
* 2) Preview panel ?
* 3) Ajax action from customizer ?
* @return  bool
* @since  3.3+
*/
function hu_is_customizing()
{
    //checks if is customizing : two contexts, admin and front (preview frame)
    return in_array(1, array(hu_is_customize_left_panel(), hu_is_customize_preview_frame(), hu_doing_customizer_ajax()));
}