Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Can you show us a page with the problem?
Hi Andrew, thank you so much for your reply. The whole thing is offline, on localhost, because as I am a beginner I am not confident to do it in the real website, so I am not sure how could I show you, nor I see how can I send a screenshot.
All I can say is that I have been customizing an already custom template and at some point, I didnt notice, this line started to appear at the bottom of the content in every page.
I did modifications in files header, functions, style following several tips for different things I have been trying out. Now I want to finally export the whole new thing and cannot have this line removed.
I am not so OK with applying a code to hide those warnings, cause I suppose they have a reason to appear.. but don’t know where this comes from!
To be precise:
in the container area, at the bottom of each content, this appears:
‘header-menu’, ‘container_class’ => ‘header_menu_class’ ) ); ?>
Is there any tool I could use to locate where this comes from?
UPDATE:
WP_DEBUG is already set to ‘false’ in my config file, so that means this is not a php notice? What is this actually? I don’t even know how to call what I am looking for…. đ
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
It’s not a PHP notice you’re right.
Are you using a caching plugin? A caching plugin will save old versions of the website, so it could be showing the bug even if you’ve fixed it.
HI Andrew,
no, I don’t have any caching plugin.
Weeks ago I followed a tutorial on how to create a new menu area, which I have done to create a Header menu. The code inserted looks fine, since now wordpress indeed shows it.
It took me so much work to figure out how to create a menu for that area that I am not ok with the idea of deleting this piece of code which was inserted in functions.php file. I am afraid of messing the whole thing but I will give a try, since apparently there is no way to know the source of this line… I don’t even know what it means, but thanks!
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Where does it appear in the functions.php file? Can you paste here the line above where it appears, as well as the code itself?
E.g.:
?>
âheader-menuâ, âcontainer_classâ => âheader_menu_classâ ) ); ?>
nonon, this does not appear anywhere! that is my problem! I don’t know where it comes from!
It is not written in any of the files (cause I search ALL) and it appears on my frond end, at the bottom of every content area of every page.
The only thing related to ‘header menu’ I have done was to create and register such an area, following a tutorial, I have inserted
function register_my_menu() {
register_nav_menu(‘header-menu’,__( ‘Header Menu’ ));
}
add_action( ‘init’, ‘register_my_menu’ );
This have indeed created this option of menu, that is all. now I have this appearing written in all my pages. And I have not noticed before, so I don’t know what have cause this to appear.
And if I go in functions and delete this, the menu are will disappear and everything I put there will disappear, I suppose..
I have now tried to selected this text and right click ‘view page source’. There I see:
<div id=”comments”>
</div><!– #comments –>
<?wp_nav_menu( array( ‘theme_location’ => ‘header-menu’, ‘container_class’ => ‘header_menu_class’ ) ); ?>
</div><!– #content –>
</div><!– #container –>
So, that means this is a comment? But what is generating this comment? and How to remove it?
Just deleted the created menu area. nothing happens.
I still get this line on my front end, so it does not come from functions.php!
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
So, that means this is a comment? But what is generating this comment? and How to remove it?
It’s not a comment, it has just been jumbled with an opening PHP tag.
It’s probably meant to look like this:
<? wp_nav_menu( array( âtheme_locationâ => âheader-menuâ, âcontainer_classâ => âheader_menu_classâ ) ); ?>
What may be happening is your local installation not recognising the shorthand PHP tag (“<?”). PHP that is not recognised by the server will be output as plain text on the browser.
Try the answer in this topic: https://stackoverflow.com/questions/880150/why-would-shorthand-php-opening-statements-not-be-working
just posted a screenshot of it, if that helps to understand…
Hi Andrew, thank you very much I will follow that lead, I will post back if I solve as it might help other beginners! Greetings from Berlin!
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
I see. Does the problem persist when switching to the Twenty Sixteen theme? Just to make sure it’s definitely coming from your theme.
Great idea1 yes, I have just changed and the line disappear. Back to my customized template, it is showing there in every page… I am reading the posts regarding php tags to see if I understand first before messing up even more.
SOLVED!!!!
Indeed, I just had to change <? to <?php at the opening and it disappeared!
I didn’t even have to write anything about short_open_tag on a php.ini file, nothing,
I just located finally the line and added 3 miraculous letters
Thank you soo much, Andrew! All the best!