%3$s',
$menu_array = array();
public function set_items_wrap($items_wrap) {
$this->items_wrap = $items_wrap;
return $this;
}
public function set_container_class($container_class) {
$this->container_class = $container_class;
return $this;
}
public function set_walker() {
$this->walker = new nav_walker();
return $this;
}
public function set_items($items) {
$this->items = $items;
return $this;
}
public function set_menu_name($menu_name) {
$this->menu_name = $menu_name;
return $this;
}
public function set_menu($menu) {
$this->menu = $menu;
return $this;
}
public function set_theme_location($theme_location) {
$this->theme_location = $theme_location;
return $this;
}
public function set_fallback_cb($fallback_cb) {
$this->fallback_cb = array($this, 'default_menu');
return $this;
}
public function set_depth($depth) {
$this->depth = $depth;
return $this;
}
public function set_link_before($link_before) {
$this->link_before = $link_before;
return $this;
}
public function set_link_after($link_after) {
$this->link_after = $link_after;
return $this;
}
public function set_before($before) {
$this->before = $before;
return $this;
}
public function set_after($after) {
$this->after = $after;
return $this;
}
public function set_echo($echo) {
$this->echo = $echo;
return $this;
}
public function set_container($container) {
$this->container = $container;
return $this;
}
public function set_menu_class($menu_class) {
$this->menu_class = $menu_class;
return $this;
}
public function set_menu_array($menu_array) {
$this->menu_array = $menu_array;
return $this;
}
public function __construct() {
$this->fallback_cb = array($this,'default_menu');
}
/**
* Factory pattern
* @return \EXT_WPNavs
*/
public function factory() {
return $factory = new TPL_NavMenu();
}
public function default_menu(){
}
/**
*
* Ttp_NavMenu::factory()->set_depth(0)->menu('primary');
*
* @param type $theme_location
* @return \cwp_navs
*/
public function menu($theme_location) {
//$this->theme_location = $theme_location;
$this->theme_location = $theme_location;
wp_nav_menu(array(
'theme_location' => $this->theme_location,
'fallback_cb' => $this->fallback_cb,
'container' => $this->container,
'container_class' => $this->container_class,
'menu_class' => $this->menu_class,
'echo' => $this->echo,
'before' => $this->before,
'after' => $this->after,
'link_before' => $this->link_before,
'link_after' => $this->link_after,
'depth' => $this->depth,
'walker' => $this->walker
));
return $this;
}
public function add_loginout() {
add_filter('wp_nav_menu_items', array($this, 'loginout'), 10, 2);
}
/**
* @param type $items
* @param type $args
* @param type $location
* @return string
*/
public function loginout($items, $args) {
if (is_user_logged_in() && $args->theme_location == $this->theme_location) {
$items .= '