コード例 #1
0
                $widget_after .= '<input type="hidden" name="sidebar_name" class="sidebar-name" value="' . esc_attr($params[0]['name']) . '" />';
                // Sidebar Name
                $widget_after .= '<input type="hidden" name="sidebar_id" class="sidebar-id" value="' . esc_attr($params[0]['id']) . '" />';
                // Sidebar ID
                // Modify the 'after_widget' param to include data we'll  send to Customizer
                $params[0]['after_widget'] = $widget_after . $params[0]['after_widget'];
            }
            return $params;
        }
        /**
         * This function outputs the WordPress Link Dialog template.
         */
        public function wp_footer()
        {
            // WordPress Link Dialog
            if (!class_exists('_WP_Editors')) {
                require ABSPATH . WPINC . '/class-wp-editor.php';
            }
            _WP_Editors::wp_link_dialog();
        }
    }
    /**
     * Create an instance of the Note_Customizer class.
     */
    function Note_Customizer()
    {
        return Note_Customizer::instance();
    }
    Note_Customizer();
    // Note your content!
}
コード例 #2
0
ファイル: class-note-widget.php プロジェクト: ITJ-RSA/note
 /**
  * This function enqueues the necessary styles associated with this widget on admin.
  */
 public function admin_enqueue_scripts($hook)
 {
     // Only on Widgets Admin Page
     if ($hook === 'widgets.php') {
         // Note Widget Admin CSS
         wp_enqueue_style('note-widget-admin', Note::plugin_url() . '/assets/css/widgets/note-widget-admin.css', array('dashicons'), Note::$version);
         //Note Widget Admin
         wp_enqueue_script('note-widget-admin', Note::plugin_url() . '/assets/js/widgets/note-widget-admin.js', array('jquery', 'underscore'), Note::$version, true);
         // Only in the widgets admin
         if (!is_customize_preview()) {
             // Grab the Note Customizer instance
             $note_customizer = Note_Customizer();
             // Setup Note Widget localize data (data is stored in $note_customizer->note_localize after this function runs)
             $note_customizer->setup_note_widget_localize_data();
             // Localize the Note Customizer script information
             wp_localize_script('note-widget-admin', 'note', $note_customizer->note_localize);
         }
     }
 }