WordPress.org

Ready to get started?Download WordPress

Forums

MarketPress - WordPress eCommerce
Conditional tags. (4 posts)

  1. projectfuturism
    Member
    Posted 3 years ago #

    Hi there,

    I need to use conditional tags to target my product pages. I use the 'widget logic' plugin which can target pages/posts using conditional tags ie: is_single( '17' )

    I thought the product pages would be custom post types, however I can't seem to find the code that registers the product page as a custom post type.

    Can somebody tell me how the best way to target the individual products page with conditional tags would be, as I need to include some stuff in the sidebar there.

    Cheers, PF

  2. projectfuturism
    Member
    Posted 3 years ago #

    OK, Short term I'm using

    is_page( '1019' )

    But it's not very flexible if I was to get say...1000 products, so would still appreciate a more flexible answer.

  3. DavidM
    Member
    Posted 3 years ago #

    Hi projectfuturism,

    If I've understood you right, I imagine that would be the only way to target the products individually.

    Alternatively, you could check whether you're on a project page using the following:
    is_singular( 'product' )

    Would that work for you?

  4. projectfuturism
    Member
    Posted 3 years ago #

    Brilliant, that worked fine.

    I've been trying

    is_single('product')

    Which wasn't working, but this has worked perfect!

    Thanks very much.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic