• Resolved Marcus

    (@omako)


    Hi there, I am using your free plugin and was just wondering how to target CSS for this Onsales Page. I would like to hide the class “onsale” for all Products only on this very page. Usually I would look for something like page-id-xx but that doesn’t seem to be possible here… Thanks

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author wpgenie2

    (@wpgenie2)

    Hello,

    for that you can add to your child-theme/functions.php following code snippet:

    function wpgenie_add_custom_body_class( $classes ) {

    global $wp_query;

    if ( $wp_query->is_sale_page ) {
    $classes[] = 'my-on-sale-page-class';
    }

    return $classes;
    }
    add_filter( 'body_class', 'wpgenie_add_custom_body_class' );

    Save and in child-theme/style.css add:

    .my-on-sale-page-class li.product.type-product {
    background: red;
    }

    This CSS is just to verify that class has been added and working. Hope this helps a bit!

    regards

    Thread Starter Marcus

    (@omako)

    Sorry, I didn’t set the toggle for ‘follow-up emails’.

    Works great. Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to target CSS’ is closed to new replies.