WordPress.org

Support

Support » Plugins and Hacks » Need some simple PHP help

Need some simple PHP help

  • bradleysue

    @bradleysue

    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…

Viewing 5 replies - 1 through 5 (of 5 total)
  • I believe this will help you along …

    if ( is_single() && in_category('blah blah') ) {
      // Share_This widget code
    }

    bradleysue

    @bradleysue

    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

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

    if ( is_single() && !in_category('blah blah') ) {
      // Share_This widget code
    }

    bradleysue

    @bradleysue

    Wow, thanks so much for your help.

    You’re welcome.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Need some simple PHP help’ is closed to new replies.
Skip to toolbar