EnmanuelGo
EnmanuelGo

Reputation: 55

Hide content in front page using conditional wordpress

Currently I am trying to hide a script in my header in some single posts using id and it is working, but I want the script not to be shown in front page, home and pages, I have not been able to get it because the script is still shown in front page, home and pages.

I am doing something wrong?

This is my code, but my script is still displayed on front, home, pages:

<?php if( !is_home() && !is_front_page() && !is_page()  ) : ?>
    <!-- No Script -->
        <?php elseif  (is_single( array( 1, '32438', '10506'  ) ) ) : ?>
        <?php else : ?>
    <script></script>
        <?php endif; ?>

Upvotes: -1

Views: 858

Answers (1)

chuysbz
chuysbz

Reputation: 1500

Does this work?

<?php if( is_home() || is_front_page() || is_page()  ) : ?>
<!-- No Script -->
    <?php elseif  (is_single( array( 1, '32438', '10506'  ) ) ) : ?>
    <?php else : ?>
<script></script>
    <?php endif; ?>

Upvotes: 1

Related Questions