A menu for each page

0

Problem:

The side menu appears on all pages. I would like to be able to use a different side menu for each page.

I know this has to do with the Wordpress theme. I'm kind of new to Wordpress. I'm using a default theme of those already installed.

Question:

Could I do what I said? Put a different side menu on each page? If so could they give me links or small information on how it should be done?

    
asked by anonymous 17.04.2014 / 19:52

1 answer

1

It is possible, but to be able to help first I need to know what this side menu is and is being called. How is the side of your site called? There is usually a file named sidebar.php in the theme that is responsible for presenting information on the side, if this is the case you can use the is_*(); functions of WordPress to check which page is being accessed and call the correct menu, eg:

If you want a menu for home and another for all internal pages:

if( is_home() ){
     // código do menu da home
}
else{
     // código do menu das internas
}

If you want a menu for home, another for all internal, and a different one for the contact page, do the following:

if( is_home() ){
     // código do menu da home
}
else if( is_page( 'contato' ) ){
     // código do menu da página de contato
}
else{
     // código do menu de todas as outras páginas
}

Notice that it's quite relative?

    
19.04.2014 / 01:55