PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, January 27, 2022

[FIXED] Hide content in front page using conditional wordpress

 January 27, 2022     if-statement, wordpress     No comments   

Issue

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; ?>

Solution

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; ?>


Answered By - CodeChuck
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing