If statements for banner images - by fourth-element

This topic has 3 replies, 2 voices, and was last updated 7 years, 2 months ago ago by Rose Tyler

  • Avatar: fourth-element
    fourth-element
    Participant
    August 24, 2017 at 13:54

    Hi

    Could you advise on how to target the category, category product and product pages.

    I am using a child theme to add banner images 100% full width under the header and above the breadcrumbs. I have created a new template to add this and I am pulling the category image for the banner from the category thumbnail.

    I will add a static image for all product pages but would like to add an if statement to place the applicable code on the applicable page.

    So far i have this just for the category page:

    <?php if ( is_page_template( ‘content-product_cat.php’ ) ) {; ?>
    <section>

    <div class=”full-width”>

    <div class=”header-image” data-stellar-ratio=”0.85″ style=”position:relative; display:block !important; overflow:hidden;”>
    <?php do_action( ‘woocommerce_archive_description’ ); ?><!– This will place the category thimbnail as the header image –>
    </div>

    </div>

    </section>
    <?php } else { ?>
    <!–nothing happens–>
    <?php } ?>

    this is not working it is just showing the else statement.

    Is there a way to target each page e.g..

    if category page (show this) and if product page (show this)?

    Thanks

    2 Answers
    Avatar: fourth-element
    fourth-element
    Participant
    August 24, 2017 at 16:14

    I’ve found the conditional tags for woo commerce pages.
    https://docs.woocommerce.com/document/conditional-tags/

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    August 25, 2017 at 08:48

    Hello,

    Is your issue solved?

    Regards

  • Viewing 3 results - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.