Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
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? –  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. –  BeEasy 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
add comment

1 Answer 1

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()) : ?>
    <script>
        jQuery(function ($) {
            $('#DIV-ID-HERE').remove();
        });
    </script>
<?php endif; ?>

// EDIT
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. –  BeEasy Apr 11 '13 at 14:57
1  
Method A worked for my project. Thanks for your time and assistance. –  BeEasy Apr 17 '13 at 2:16
add comment

Your Answer

 
discard

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.