function in_menu($ds_lbv, $ma) { foreach ($ds_lbv as $lbv) { if ($lbv['parent_id'] == $ma) { if (kiem_tra_co_con($ds_lbv, $lbv['id'])) { if (check_role($lbv['link'], 'view') || 0) { echo '<li><a href="javascript:;"><i class="' . $lbv['icon'] . '"></i><span>' . $lbv['title'] . '</span></a>'; } echo '<ul class="acc-menu">'; in_menu($ds_lbv, $lbv['id']); echo '</ul>'; } else { if (check_role($lbv['link'], 'view') || 0) { $links = '<a href="' . site_url($lbv['link']) . '">'; echo '<li>' . $links . '<i class="' . $lbv['icon'] . '"></i><span>' . $lbv['title'] . '</span></a>'; } } echo '</li>'; } } }
<nav id="left-col"> <?php if (isset($post->ID)) { $id = $post->ID; ?> <?php if ((in_menu($id) || is_page() || sizeof($post->ancestors) > 0) && !is_search()) { $walker = new Razorback_Walker_Page_Selective_Children(); ?> <ul id="left-nav"> <?php global $force_menu; if (is_page() || $force_menu) { if ($post->post_parent) { // This is a subpage $get_children_of = isset($post->ID) ? (int) $post->ancestors[count($post->ancestors) - 1] : 0; } else { // This is not a subpage $get_children_of = isset($post->ID) ? (int) $post->ID : 0; } $ptg = sizeof($post->ancestors) > 0 ? $post->ancestors[sizeof($post->ancestors) - 1] : $post; $children = wp_list_pages(array('sort_column' => 'menu_order', 'title_li' => '', 'child_of' => $get_children_of, 'walker' => $walker, 'echo' => 0, 'meta_key' => 'hide_in_left_nav', 'meta_value' => '0')); if (function_exists('get_field') && !get_field('hide_in_left_nav', $ptg)) { if (function_exists('get_field')) { $nav_title = get_field('left_nav_menu_title', $ptg); } $page_title = $nav_title == "" ? get_post($ptg)->post_title : $nav_title;