Nav won't work in content section

As you can see I copied my main nav and tried to put it in the content section of this page. However, it won’t work. I actually put it in the template and the content section just to see if I could get it to work outside of the header. It is working in the template, but I’d like to get it to work in the content section.

Can someone tell me my problem?


Just a suggestion, but try replacing those curly quotes around the MainNavication words. I.e. instead of


do this


Interesting. The curly brackets don’t show in my code when you view the page source. However, my code does not look like this, ‘MainNavigation’

It looks like this

<div id=“MainNavigation”>

	&lt;ul id="MainNav"&gt;
    &lt;?php wp_nav_menu( array('menu' =&gt; 'MainNavigation' )); ?&gt;


</div> <!–MainNavigation–>

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<div class=“Calendar”>


<iframe src=“” style=“border: 0” width=“1000” height=“600” frameborder=“0” scrolling=“no”></iframe>

</div> <!–Calendar–>

Why is the code being output that way?

This shows up in the source code of your page:

<ul id="MainNav">
<p>        <?php wp_nav_menu( array('menu' => [COLOR="#FF0000"]&#82[/COLOR][COLOR="#FF0000"]16;[/COLOR]MainNavigation[COLOR="#FF0000"]&#82[/COLOR][COLOR="#FF0000"]17;[/COLOR] )); ?></p>

You need to address that. No matter what you think you are seeing, that is what you are actually sending to the browser.

Well, i know that I’m seeing different code in the text section of my wordpress page. I have no idea where to start when the code that I’m entering is totally different than what’s being output…?

Check the template where that PHP code resides. I’ll wager it looks exactly like what I posted, except that the character references may just appear as curly quotes (e.g. ‘MainNavigation’).

If nothing else, delete those quote marks and retype them with single quotes.

I don’t see the curly braces in the template or in the body content.

Anyhow, as I said, delete the quotes and retype them, just to be sure.

I tried removing the quotes and adding them back. The funny thing is that wordpress is placing <p> tags around the nav code. Why would it do that?

Ah, that might be a clue to the problem. The system doesn’t recognize it as PHP, possibly because there is no gap between the closing ?> and what comes before it.

<?php wp_nav_menu( array('menu' => 'CalendarNavigation' ))[COLOR="#FF0000"];?>[/COLOR] 

That wasn’t the case earlier, I don’t think, but anyhow, you might as well add a gap in there and see if it helps:

<?php wp_nav_menu( array('menu' => 'CalendarNavigation' ))[COLOR="#FF0000"]; ?>[/COLOR] 

I actually did that earlier trying to figure out what the problem is. I fixed it and this issue is just lame :confused:

Hehe, now there is a gap here that you don’t want:

<? php

Don’t put a gap in there. You want a gap after it, but not between ? and php. Did you do that, or is the system doing this?

I’ve fixed those. I’ve copied this code and pasted it from the main nav that is working. Something else must be funky. thx

Yeah, in the actual browser inspector, this is what appears:

 <[COLOR="#FF0000"]!--[/COLOR]?php wp_nav_menu(array('menu' =[COLOR="#FF0000"]-->[/COLOR] &#8216;CalendarNavigation&#8217; )); ?>

LOL, what a mess. Must be the browser’s attempt to make sense of that PHP code that isn’t processing.

Perhaps see if any errors are being output.

Are you sure “CalendarNavigation” is the right name?

I copied the main nav code just to test it, then I was going to edit the name for a new nav. Can I repost this somehow so that others see it??

I’m not sure what you mean.

I’m saying maybe if I post it afresh then maybe others will view it and have a solution. I’m really stumped on why I can’t get this to work because I’ve done it on other websites.

In a situation like that, I go through the working version with a fine too comb and compare it with the non-working version until I find the critical difference.