> Menus screen in the WP admin area. * * Note: The comments above each function are pretty much verbatim * from the corresponding WP documentation. * * @link http://codex.wordpress.org/Widgets_API * @uses \WP_Widget */ class widget_menu extends \WP_Widget { /** * Sets up the widgets ID, name, and description. */ public function __construct() { $title = __( '- BluePrint-Q - Menu', 'bpq' ); $description = __( 'Add a custom menu styled with Boostrap\'s pills and populated with BluePrint-Q\'s options.', 'bpq' ); parent::__construct( 'widget_menu', $title, array( 'description' => $description ) ); } /** * Outputs the content of the widget. * * @param array $args * @param array $instance */ public function widget( $args, $instance ) { // Wrap start. echo $args['before_widget']; // Keeping with the WP pattern, display the title. $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); if ( !empty( $instance['title'] ) ) echo $args['before_title'].$instance['title'].$args['after_title']; // Get the menu that the Developer selected - if there is no menu, then early exit. $menu_id = !empty( $instance['menu_id'] ) ? wp_get_nav_menu_object( $instance['menu_id'] ) : false; if ( !$menu_id ) return; // Making it here means that we can generate and display the menu - the class // that is applied to the