WordPress.org

Forums

If condition on a tag (4 posts)

  1. webbrewers
    Member
    Posted 3 years ago #

    Simple question - hopefully a simple answer:
    I want to show a different image based on a specific set of tags (in wp ecommerce products entries). This works with categories but I'm not sure how to refine it to tags:

    <?php if (wpsc_category_name( $category ) == 'cata') : ?>
    <img src="blah" />
    <?php else : ?>
    <img src="blah2" />
    <?php endif ?>

    I see tag_name in the available functions but it doesn't seem to work?

  2. I'm not sure about wp ecommerce, but try has_tag() to test if a post has a tag or not.

    <?php if ( has_tag( 'Some Tag' ) ) { ?>
       <img src="blah" />
    <?php } else { ?>
       <img src="blah2" />
    <?php } ?>

    http://codex.wordpress.org/Function_Reference/has_tag

  3. webbrewers
    Member
    Posted 3 years ago #

    Thanks for responding.
    Doesn't seem to work with wp ecommerce. Any variation I try like wpsc_product_tag etc is undefined.

  4. Not sure if it's the same plugin, but this site looks like it has some documentation that may be helpful.

    http://docs.getshopped.org/

    Or not, I've never used any ecommerce plugins myself...

Topic Closed

This topic has been closed to new replies.

About this Topic