nav_menu = $nav_menu; $this->config = require(ITALYSTRAP_PLUGIN_PATH . 'config/nav-menu.php'); /** * I don't like this and I have to find a better solution for loading script and style for widgets. */ // add_action( 'admin_enqueue_scripts', array( $this, 'upload_scripts' ) ); $fields = array_merge($this->title_field(), $this->config); /** * Configure widget array. * * @var array */ $args = [ // Widget Backend label. 'label' => __('ItalyStrap Nav Menu', 'italystrap'), // Widget Backend Description. 'description' => __('Add an advanced custom menu to your sidebar.', 'italystrap'), 'fields' => $fields, 'widget_options' => ['customize_selective_refresh' => true], 'control_options' => ['width' => 450], ]; /** * Create Widget */ $this->create_widget($args); } /** * Dispay the widget content * * @param array $args Display arguments including 'before_title', 'after_title', * 'before_widget', and 'after_widget'. * @param array $instance The settings for the particular instance of the widget. */ public function widget_render($args, $instance) { // echo "
"; // print_r($instance['nav_menus']); // echo ""; // Get menu $nav_menu = ! empty($instance['nav_menu']) ? wp_get_nav_menu_object($instance['nav_menu']) : false; if (! $nav_menu) { return; } $nav_menu_args = [ 'echo' => false, 'fallback_cb' => '', 'menu' => $nav_menu, 'container' => false, // WP Default div. 'container_class' => false, 'container_id' => false, 'menu_class' => 'list-inline info-menu flex-menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '