WordPress.org

Ready to get started?Download WordPress

Forums

WP e-Commerce
[resolved] Single product page conditional (7 posts)

  1. nicknack
    Member
    Posted 4 months ago #

    Trying to add a condition in the single-product template but can't get it to work.

    <?php if(is_tax( 'wpsc_product_category', 'category-slug') & is_singular( ‘wpsc-product’ )) : ?>
    <p>Something</p>
    <?php else: ?>
    <p>Something else</p>
    <?php endif; ?>

    Very grateful for any ideas
    Thanks

    http://wordpress.org/plugins/wp-e-commerce/

  2. whitelamp
    Member
    Posted 4 months ago #

    <?php if(is_tax( 'wpsc_product_category', 'category-slug') & is_singular( ‘wpsc-product’ )) : ?>

    Hi Nick,

    is that a typo or what you've actually got? It's double && for logical AND.

    Otherwise:

    $msg = print_r(is_tax( 'wpsc_product_category', 'category-slug'), true);
    $msg .= print_r(is_singular( ‘wpsc-product’ ), true);

    mail('you', 'debug', $msg);

  3. nicknack
    Member
    Posted 4 months ago #

    Hi Dom
    Yes no typo, added the double && but still not working
    looks like this now
    <?php if(is_tax( 'wpsc_product_category', 'category-slug') && is_singular( ‘wpsc-product’ )) : ?>
    Cheers

  4. whitelamp
    Member
    Posted 4 months ago #

    And the debug mail output?

  5. Mihai
    Member
    Plugin Author

    Posted 4 months ago #

    not sure if it counts but your wpsc-product quotes look weird here:
    they look like apostrophes.

    Instead of ' they look like ` from what you pasted.

  6. nicknack
    Member
    Posted 4 months ago #

    Hi Misulicus
    Yes they were apostrophes, although hasn't made any difference unfortunately

  7. nicknack
    Member
    Posted 4 months ago #

    This works, (cheers Dom)

    <?php if(has_term('category-slug', 'wpsc_product_category' ) && is_singular( 'wpsc-product' )) : ?>
    <p>Something</p>
    <?php else: ?>
    <p>Something else</p>
    <?php endif; ?>

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.