There are vertical and horizontal menus built into my theme. I want the vertical menu to appear only on one page. I know the following HTML codes define the difference, but I don't know how to make the change.

<div id="page" class="layout-fullwidth">
<div id="page-24331" class="layout-fullwidth vertical-header">

I tried making a page-24331.php file and then copying over the page.php code, but then I didn't know how to define the specific class.

Is there an easier way to do this? Would a conditional menu plugin be helpful even though, in this case, it's a menu style not the menu content? I'm a beginner when it comes to PHP, so any help would be great. Thanks!

  • Hi. Sorry but I'm still not sure what you want. Did you write these HTML codes? If not, then why you can't use CSS to hide them on the pages you want?
    – Johansson
    Aug 22, 2017 at 5:56
  • Which theme is it?
    – deflime
    Aug 22, 2017 at 7:58
  • I didn't write them. I used Firebug to identify each of them. I want the vertical menu just on the homepage (id-24331) and the horizontal menu on all other pages. Aug 23, 2017 at 1:10
  • The theme is "The Gem" Aug 23, 2017 at 1:11

1 Answer 1


You'll want to search your theme files for the part of the page template that is controlling those classes, likely page.php would be a good place to start.

Then once you find the part you think is controlling the output, try adding:

if( is_page(24331) ) { echo 'vertical-header'; }

For example:

<div id="page" class="layout-fullwidth <?php if( is_page(24331) ) { echo 'vertical-header'; } ?>">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.