WordPress.org

Ready to get started?Download WordPress

Forums

Need some simple PHP help (6 posts)

  1. bradleysue
    Member
    Posted 4 years ago #

    Hi there, php experts.

    How do you combine conditions in a conditional php statement?
    If this is a single post AND is in category('blah blah')
    [then show the ShareThis widget - have the php for this]

    Thanks for your help...

  2. Edward Caissie
    Theme Review Admin
    Posted 4 years ago #

    I believe this will help you along ...

    if ( is_single() && in_category('blah blah') ) {
      // Share_This widget code
    }
  3. bradleysue
    Member
    Posted 4 years ago #

    Thank-you cais, that's perfect.
    One other question - how do I say NOT in category ('blah blah').

    In other words - if is single and NOT in category=blah blah then share-this widget code

  4. Edward Caissie
    Theme Review Admin
    Posted 4 years ago #

    The exclamation mark ( ! ) is used for 'not', such as:

    if ( is_single() && !in_category('blah blah') ) {
      // Share_This widget code
    }
  5. bradleysue
    Member
    Posted 4 years ago #

    Wow, thanks so much for your help.

  6. Edward Caissie
    Theme Review Admin
    Posted 4 years ago #

    You're welcome.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.