Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Aug 2003
    Posts
    194
    Member #
    2782
    Hi Everyone,
    I need to show a specific div if the user is not on the home page or on the about page.
    I don't think I got the "or" syntax right on the first line because if I do them separately they work. Here is what I got:
    Code:
    <?php if(!is_page('about') || (!is_home()) { ?>
    <div id="special">show</div>
    <?php } ?>
    Can someone please advise on how to properly write this code so that the DIV only shows when you are on any page but the home page or about page?

    Thanks.

  2.  

  3. #2
    WDF Staff AlphaMare's Avatar
    Join Date
    Oct 2009
    Location
    Montreal, Canada
    Posts
    4,570
    Member #
    20277
    Liked
    878 times
    I think this may help you out: a video tutorial (about 28 minutes long, very good, it takes you from basics to finished, with alive demo on how to use them.)
    And the slides from that presentation are available here - with clickable links to code snippets and more info.
    Good design should never say "Look at me!"
    It should say "Look at this." ~ David Craib


    http://digitalinsite.ca ~ my current site . . info@digitalinsite.ca ~ my email

    If you feel that someone's post helped you fix your problem, answered your question, or just made you feel better, feel free to "Like" their post. The "Like" link is at the bottom right of each post, along side the "reply" link. And if you are being helped here, try to help someone else - pass it on!

  4. #3
    Senior Member
    Join Date
    Aug 2003
    Posts
    194
    Member #
    2782
    Thank you for the reference. It gave me a little more insight for the "if" statements but I still had to play with it a bit in order to get the "!" to work. I finally ended up with:
    Code:
    <?php if(!(is_front_page() || is_page('about')) ): ?>
    <div id="special">show</div>
    <?php endif; ?>
    Thanks.

  5. #4
    Member jwind's Avatar
    Join Date
    Nov 2010
    Location
    On a mac
    Posts
    76
    Member #
    24894
    Liked
    4 times
    Quote Originally Posted by Abstract, post: 237065
    Thank you for the reference. It gave me a little more insight for the "if" statements but I still had to play with it a bit in order to get the "!" to work. I finally ended up with:
    Code:
    <?php if(!(is_front_page() || is_page('about')) ): ?>
    <div id="special">show</div>
    <?php endif; ?>
    Thanks.
    That will show the div content if it's NOT the homepage or the page "about". !=not BTW.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

php if not home page

,

php if not page

Click on a term to search for related topics.
All times are GMT -6. The time now is 09:59 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com