Guest User

Untitled

a guest
Aug 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. add_filter( 'wp_nav_menu_items', 'x_custom_menu', 10, 2 );
  2. function x_custom_menu( $items, $args ) {
  3.     session_start();
  4.     if (isset($_SESSION['username']) && $args->theme_location == 'primary') {
  5.         $items .= '<li><a href="'. site_url('questions') .'">Questions</a></li><li><a href="'. site_url('logout.php') .'">Log Out</a></li>';
  6.     }
  7.     elseif (!isset($_SESSION['username']) && $args->theme_location == 'primary') {
  8.         $items .= '<li><a href="'. site_url('signup') .'">Get started</a></li>';
  9.     }
  10.     return $items;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment