예제 #1
0
function et_pb_admin_scripts_styles($hook)
{
    global $typenow;
    //load css file for the Divi menu
    wp_enqueue_style('library-menu-styles', ET_BUILDER_URI . '/styles/library_menu.css', array(), ET_BUILDER_VERSION);
    if ($hook === 'widgets.php') {
        wp_enqueue_script('et_pb_widgets_js', ET_BUILDER_URI . '/scripts/ext/widgets.js', array('jquery'), ET_BUILDER_VERSION, true);
        wp_localize_script('et_pb_widgets_js', 'et_pb_options', array('ajaxurl' => admin_url('admin-ajax.php'), 'et_load_nonce' => wp_create_nonce('et_load_nonce'), 'widget_info' => sprintf('<div id="et_pb_widget_area_create"><p>%1$s.</p><p>%2$s.</p><p><label>%3$s <input id="et_pb_new_widget_area_name" value="" /></label></p><p class="et_pb_widget_area_result"></p><button class="button button-primary et_pb_create_widget_area">%4$s</button></div>', esc_html__('Here you can create new widget areas for use in the Sidebar module', 'et_builder'), esc_html__('Note: Naming your widget area "sidebar 1", "sidebar 2", "sidebar 3", "sidebar 4" or "sidebar 5" will cause conflicts with this theme', 'et_builder'), esc_html__('Widget Name', 'et_builder'), esc_html__('Create', 'et_builder')), 'delete_string' => esc_html__('Delete', 'et_builder')));
        wp_enqueue_style('et_pb_widgets_css', ET_BUILDER_URI . '/styles/widgets.css', array(), ET_BUILDER_VERSION);
        return;
    }
    if (!in_array($hook, array('post-new.php', 'post.php'))) {
        return;
    }
    /*
     * Load the builder javascript and css files for custom post types
     * custom post types can be added using et_builder_post_types filter
     */
    $post_types = et_builder_get_builder_post_types();
    if (isset($typenow) && in_array($typenow, $post_types)) {
        et_pb_add_builder_page_js_css();
    }
}
예제 #2
0
function et_pb_admin_scripts_styles($hook)
{
    global $typenow;
    if ($hook === 'widgets.php') {
        wp_enqueue_script('et_pb_widgets_js', ET_PB_URI . '/js/widgets.js', array('jquery'), ET_PB_VERSION, true);
        wp_localize_script('et_pb_widgets_js', 'et_pb_options', array('ajaxurl' => admin_url('admin-ajax.php'), 'et_load_nonce' => wp_create_nonce('et_load_nonce')));
        wp_enqueue_style('et_pb_widgets_css', ET_PB_URI . '/css/widgets.css', array(), ET_PB_VERSION);
        return;
    }
    if (!in_array($hook, array('post-new.php', 'post.php'))) {
        return;
    }
    $post_types = apply_filters('et_pb_builder_post_types', array('page', 'project'));
    /*
     * Load the builder javascript and css files for custom post types
     * custom post types can be added using et_pb_builder_post_types filter
     */
    if (isset($typenow) && in_array($typenow, $post_types)) {
        et_pb_add_builder_page_js_css();
    }
}