WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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? – Johannes Pille Apr 11 '13 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. – Bryan Barrera Apr 11 '13 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? – Johannes Pille Apr 11 '13 at 14:57
up vote 5 down vote accepted

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.

share|improve this answer
I'll try this out. Thanks for your input. – Bryan Barrera Apr 11 '13 at 14:57
Method A worked for my project. Thanks for your time and assistance. – Bryan Barrera Apr 17 '13 at 2:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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