Wordpress shows PHP code instead of menu content -


i've encountered strange problem menus after moving wordpress local environment live server.

on local server, menus displayed correctly, while on live server, there piece of menu code shown instead of actual menu. (basically, cuts off code after => in first argument of array , outputs rest of code instead of showing menu.)


local server version local server version


live server version live server version


everything else working – backend fine, links work correctly too, makes me think migration went okay, , problem in php itself.

the whole code menu in header.php looks (there 2 menus next each other):

<div class="collapse navbar-collapse" id="main-navigation-collapse">     <? wp_nav_menu (array(         'sort_column' => 'menu_order',         'menu_class' => 'nav navbar-nav list-inline',         'theme_location' => 'primary'     )); ?>     <? wp_nav_menu (array(         'sort_column' => 'menu_order',         'menu_class' => 'nav navbar-nav navbar-right list-inline',         'theme_location' => 'top-menu'     )); ?> </div> 

the menus registered in functions.php this:

register_nav_menus( array(     'primary' => __( 'primary menu', 'be-emobil' ),     'top-menu' => __('top menu', 'be-emobil'),     'footer-menu' => __('footer menu', 'be-emobil'),     'footer-menu-2' => __('footer menu 2', 'be-emobil') ) ); 

some info might useful:

  • i'm using _s (underscores) theme base.
  • local php version 5.6.7
  • live php version 5.6.8-pl0-gentoo

any idea why might happening or how find out wrong?

your live server doesn't have short tags enabled.

you can following:

  • change <? <?php
  • enable short tags in php.ini
  • enable short tags in .htaccess file
  • use php ini_set enable short tags in file

depending on access php.ini, .htaccess etc. on live server, you'll want choose solution accordingly


Comments