Need some simple PHP help (6 posts)

  1. bradleysue
    Posted 6 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. I believe this will help you along ...

    if ( is_single() && in_category('blah blah') ) {
      // Share_This widget code
  3. bradleysue
    Posted 6 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. The exclamation mark ( ! ) is used for 'not', such as:

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

    Wow, thanks so much for your help.

  6. You're welcome.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.