示例#1
0
 /**
  * Register Nav Menus.
  *
  * @see http://codex.wordpress.org/Navigation_Menus
  */
 public static function registerNavMenus()
 {
     add_action('init', function () {
         foreach (Menu::getMenusActive() as $menu) {
             $menus[$menu] = I18n::transu($menu);
         }
         register_nav_menus($menus);
     });
 }
 public function __construct()
 {
     parent::__construct();
     // Widgets
     foreach (Widgets::getDinamicSidebarActive() as $sidebarActive) {
         ob_start();
         dynamic_sidebar($sidebarActive);
         $this->widgets[$sidebarActive] = ob_get_clean();
     }
     // Menus
     foreach (Menu::getMenusActive() as $menuActive) {
         $this->menus[$menuActive] = wp_nav_menu(['echo' => false, 'theme_location' => $menuActive, 'menu_class' => 'nav navbar-nav menu ' . str_replace('_', '-', $menuActive), 'walker' => new WalkerNavMenu()]);
     }
 }