WordPress template if/else

  1. I want to add an if/else statement to the header.php file to show a block of code if its the homepage, else show another block of code. How can I implement this on the actual template header.php file?

  2. My header.php file is correctly pulling in the nav as:

<li>menu 1</li>

What do i need to change to add a <span> tag inside the menu loop like this:

<li><span>menu 1</span></li>

  1. I am looking for a photo gallery addon with categories and comments. I want to be able to setup a few categories of photos and upload photos and have users comment on them. Any suggestions?


if ( is_home() ) {
    // This is a homepage
} else {
    // This is not a homepage

2.) Not sure, is there a reason why you can’t just style the li’s?

3.) 8 Cool Wordpress Photo Gallery Plugins | ChaseSagum.com

As for number 1, you should be able to do a simple:

if (is_home())
// show cool homepage only stuff
} else {
// show every page kinda stuff

As for #2, it depends on what it’s using to grab the menu, if it’s using wp_nav_menu(), then check here:
Function Reference/wp nav menu « WordPress Codex

Shows the arguments, and how you could do this:

wp_nav_menu(array("before" => "<span>", "after" => "</span>"));

As for #3, I know a ton of people use nextgen photo gallery, not sure if it meets your requirements though.

Ok awesome!

But I am still having an issue wrapping my menu items in a <span> tag.

I am using this in my header.php call:

wp_nav_menu(array(“before” => “<span>”, “after” => “</span>”));

And it is not putting the <span> in there. Any ideas?

Did you have a look at the various things you can do with the function?
Function Reference/wp nav menu « WordPress Codex

Worst case scenario, could you make a class for what you have that span tag styled as, and do:

wp_nav_menu(array("menu_class" => "yourClassName"));

And that should output your ul’s as ul class=“yourClassName”.