• 0

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /var/www/html/cnasolution/site/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/site/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/site/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

How to add the date in my wordpress navigation menu?

I am trying to add the date to my wordpress nav menu and I came across this code while searching online:

add_filter('wp_nav_menu_items','add_todaysdate_in_menu', 10, 2); function add_todaysdate_in_menu( $items, $args ) {     if( $args->theme_location == 'primary')  {          $todaysdate = date('l jS F Y');         $items .=  '
  • ' . $todaysdate . '
  • '; } return $items; }

    But when I add this to my functions.php file it does not update.

    I have previously added some other code to show different navigation menu's depending on whether the user is logged in or logged out.

    function my_wp_nav_menu_args( $args = '' ) {  if($args['theme_location']=="topbar_menu"){ if( is_user_logged_in() ) { $args['menu'] = 'logged_in'; } else { $args['menu'] = 'logged_out'; } } return $args; } add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' ); 

    I think it may be conflicting with this code.

    I tried to change the menu location from 'primary' to 'topbar_menu' but it still won't update so was just wondering how to modify the first code so that it will update and also display the date on my nav/topbar_menu?

    Download script demo [LINK]
    Download script demo [LINK 2] Download script demo [LINK 2]