For example if its 'is_front_page' I want to hide a div. If its not the 'is_front_page' i want to show the div. How can i achieve this?

I am not sure on how I can achieve this. Any assistance would be great. Thanks

  • 2
    I am struggling to figure out what part it is that you need help with. You found the conditional tag you want to use - where exactly is the problem now? Commented Apr 11, 2013 at 14:51
  • I am not sure on how to hide and show the elements. Meaning I am not sure on what the proper way of writing it is.
    – breezy
    Commented Apr 11, 2013 at 14:52
  • The "conditional tag" is_front_page is a PHP (server-side) function that returns a boolean value. Hence you can use it inside a PHP conditional to wrap the HTML output in. "Showing/Hiding" sort of implies client-side action. What do you want/need? Commented Apr 11, 2013 at 14:57

1 Answer 1


This is really not enough information, so I have to guess.

A) The div is part of the content

Use PHP, check for front-page, and if not, handle the div:

<?php if (! is_front_page()) : ?>
    <div />
<?php endif; ?>

B) The div is located somewhere else on the page

Give the div an ID and use jQuery:

<?php if (! is_front_page()) : ?>
        jQuery(function ($) {
<?php endif; ?>

Of course, method A should be preferred! I'd suggest to include the above code where the div is generated.

  • 1
    Method A worked for my project. Thanks for your time and assistance.
    – breezy
    Commented Apr 17, 2013 at 2:16

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.