__('Primary Menu', 'b3theme'),)); add_theme_support('post-formats', array('aside', 'image', 'video', 'quote', 'link')); add_theme_support('custom-background', array('default-color' => 'ffffff', 'default-image' => '') ); add_theme_support('post-thumbnails'); add_filter('wp_nav_menu_container_allowedtags', 'b3theme_empty_array'); add_filter('wp_nav_menu_args', 'b3theme_wp_nav_menu_args'); require B3THEME_PATH . '/inc/options.php'; $b3theme_options = get_option('b3theme_options'); if (!$b3theme_options) { $b3theme_options = b3theme_sanitize_options(array()); } add_action('admin_init', 'b3theme_admin_init'); } add_action('after_setup_theme', 'b3theme_setup'); if ( !isset( $content_width ) ) { $content_width = 970; } /* $content_width not really used currently in this theme but required by Wordpress theme autochecker. Content width is calculated and being set by Bootstrap. */ function b3theme_option($key) { global $b3theme_options; if (isset($b3theme_options[$key])) { return $b3theme_options[$key]; } return ''; } function b3theme_wp_nav_menu_args($args) { $args['container'] = false; return $args; } function b3theme_wp_page_menu($args) { $pages = get_pages(); foreach($pages as $key=>$page) { $pages[$key]->db_id = $page->ID; $pages[$key]->menu_item_parent = $page->post_parent; $pages[$key]->url = get_page_link($page->ID); } $pages = b3theme_wp_nav_menu_objects($pages); $out = '
'; return $out; } add_filter('wp_nav_menu_objects', 'b3theme_wp_nav_menu_objects'); function b3theme_wp_nav_menu_objects ($menu_items) { foreach($menu_items as $key => $item) { $sort_num_of[$item->db_id] = $key; } foreach($menu_items as $key => $item) { if ($item->menu_item_parent) { $menu_items[ $sort_num_of[$item->menu_item_parent] ]->has_children = 1; } } return $menu_items; } class Tb3theme_Walker_Nav_Menu extends Walker_Nav_Menu { function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $has_children = empty($item->has_children) ? false : true; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; if($has_children) { if ($depth ) { $classes[] = 'dropdown-submenu'; } else { $classes[] = 'dropdown'; } } $classes[] = 'depth-'.$depth; if (!is_object($args)) { $args = (object)array_merge(array('link_before' => '', 'link_after' => '', 'before' => '', 'after' => ''), $args); } $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter( $classes ), $item, $args ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $id = apply_filters('nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $output .= $indent . '