• Resolved sghoepfner

    (@sghoepfner)


    Hi All!
    I have spent about 2 hours trying to find the answer for my problem in forums, but I guess I am missing the good keywords for a start, since I dont know how to correctly describe it to search.
    On my localhost version I get this line

    ‘header-menu’, ‘container_class’ => ‘header_menu_class’ ) ); ?>

    appearing on the bottom of every content in every page. I assume I have at some point wrote in one of the files something wrong, but how can I locate the source of the error to fix it?

    All I can find is tips on how to ‘hide php notices’, etc. But I would like to be able to locate what is generating this line of code to appear, fix it.

    I have already used a php checker online and it did not point out any error like this.
    I have also open all files on Notepad ++ and searched in All Files for that line of code, but it is also not there.
    I have been doing some changes offline and I have not noticed since when this line appears, so I cannot know anymore what change in header, or function, or style.php cause this. Also when I check those files, nothing spot out as wrong.

    I tried to inspect on the browser, but also it does not point out.
    Is this a so-called PHP notice? How to trace it and fix?? I am hopeless…

    Thanks in advance!

Viewing 15 replies - 1 through 15 (of 16 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Can you show us a page with the problem?

    Thread Starter sghoepfner

    (@sghoepfner)

    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!

    Thread Starter sghoepfner

    (@sghoepfner)

    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?

    Thread Starter sghoepfner

    (@sghoepfner)

    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.

    Thread Starter sghoepfner

    (@sghoepfner)

    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’ ) ); ?>
    
    Thread Starter sghoepfner

    (@sghoepfner)

    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?

    Thread Starter sghoepfner

    (@sghoepfner)

    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

    Thread Starter sghoepfner

    (@sghoepfner)

    just posted a screenshot of it, if that helps to understand…

    Thread Starter sghoepfner

    (@sghoepfner)

    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.

    Thread Starter sghoepfner

    (@sghoepfner)

    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.

    Thread Starter sghoepfner

    (@sghoepfner)

    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!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘how to locate a line of code appearing on the site?’ is closed to new replies.