Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'wp_nav_menu_items', 'x_custom_menu', 10, 2 );
- function x_custom_menu( $items, $args ) {
- session_start();
- if (isset($_SESSION['username']) && $args->theme_location == 'primary') {
- $items .= '<li><a href="'. site_url('questions') .'">Questions</a></li><li><a href="'. site_url('logout.php') .'">Log Out</a></li>';
- }
- elseif (!isset($_SESSION['username']) && $args->theme_location == 'primary') {
- $items .= '<li><a href="'. site_url('signup') .'">Get started</a></li>';
- }
- return $items;
- }
Advertisement
Add Comment
Please, Sign In to add comment