2016-01-18, 07:04:36
get_navigation_customget_navigation
1. Create private page and add it to menu;
2. Paste this function into your website template functions.php file;
3. Use get_navigation_custom instead standart get_navigation function.
(2016-01-12, 14:55:48)jwzumwalt Wrote: How can I make a page only show on the menu if the user is logged in?
Quote:[NOT POSSIBLE] - Only show page on menu if logged inWhy not possible? A lot of things possible with GetSimple.
1. Create private page and add it to menu;
2. Paste this function into your website template functions.php file;
3. Use get_navigation_custom instead standart get_navigation function.
PHP Code:
function get_navigation_custom($currentpage,$classPrefix = "") {
$menu = '';
global $pagesArray;
$pagesSorted = subval_sort($pagesArray,'menuOrder');
if (count($pagesSorted) != 0) {
foreach ($pagesSorted as $page) {
$sel = ''; $classes = '';
$url_nav = $page['url'];
if ($page['menuStatus'] == 'Y') {
if ($page['private'] != 'Y' || is_logged_in()) {
$parentClass = !empty($page['parent']) ? $classPrefix.$page['parent'] . " " : "";
$classes = trim( $parentClass.$classPrefix.$url_nav);
if ("$currentpage" == "$url_nav") $classes .= " current active";
if ($page['menu'] == '') { $page['menu'] = $page['title']; }
if ($page['title'] == '') { $page['title'] = $page['menu']; }
$menu .= '<li class="'. $classes .'"><a href="'. find_url($page['url'],$page['parent']) . '" title="'. encode_quotes(cl($page['title'])) .'">'.strip_decode($page['menu']).'</a></li>'."\n";
}
}
}
}
echo exec_filter('menuitems',$menu);
}