I received this message on the home page of the website:
Fatal error: Uncaught error: Call to undefined function create_function( in /customers/7/e/7/jovobytes.be/httpd.www/wp-content/themes/inovado/framework/inc/widgets/custommenu ). php:67 Stack trace: #0 /customers/7/e/7/jovobytes.be/httpd.www/wp-content/themes/inovado/functions.php(39): include_once() #1 /customers/7/ e/7/jovobytes.be/httpd.www/wp-settings.php(566): include('/customers/7/e/...') #2 /customers/7/e/7/jovobytes.be /httpd.www/wp-config.php(96): require_once('/customers/7/e/...') #3 /customers/7/e/7/jovobytes.be/httpd.www/wp- load.php(50): require_once('/customers/7/e/...') #4 /customers/7/e/7/jovobytes.be/httpd.www/wp-blog-header.php(13 ): require_once('/customers/7/e/...') #5 /customers/7/e/7/jovobytes.be/httpd.www/index.php(17): require('/customers/7 /e/...') #6 {main} thrown in /customers/7/e/7/jovobytes.be/httpd.www/wp-content/themes/inovado/framework/inc/widgets/custommenu.php Go to line 67
So I searched for the files corresponding to the theme and needed to rewrite the code to be compatible with PHP 8.0. Any help would be greatly appreciated! ! !
'Display a Side Navigation')); } function widget($args, $instance) { // Get menu $nav_menu = wp_get_nav_menu_object( $instance['nav_menu'] ); if ( !$nav_menu ) return; echo $args['before_widget']; //if ( !empty($instance['title']) ) // echo $args['before_title'] . $instance['title'] . $args['after_title']; wp_nav_menu( array( 'depth' => 1, 'menu' => $nav_menu ) ); echo $args['after_widget']; } function update( $new_instance, $old_instance ) { $instance['nav_menu'] = (int) $new_instance['nav_menu']; return $instance; } function form( $instance ) { $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : ''; // Get menus $menus = get_terms( 'nav_menu', array( 'hide_empty' => false ) ); // If no menus exists, direct the user to go and create some. if ( !$menus ) { echo ''. sprintf( __('No menus have been created yet. Create some.'), admin_url('nav-menus.php') ) .'
'; return; } ?>
This very specific operation can be rewritten as:
However, the widget itself uses old-style constructor syntax, so that needs to change as well.
It's been a while since I've seen constructor syntax, so I wouldn't be surprised if more code is broken as well. You should really consider upgrading your theme/plugin to a newer version, ornotupgrading your PHP version