BuddyBoss Home – Web Support Forums Solutions Social MarketPlace add page identifier (body class) for product seller

Viewing 5 posts - 1 through 5 (of 5 total)
  • Question

    #63184
    @aaronkine

    I would like to style each Product page differently (using CSS) depending on who the Store Seller is. What php / hook / filter etc… can i use to add a specific CLASS to the Body tag (or anywhere else) that would allow me to use CSS and style every product page differently depending on who the Seller is (Vendor / Shop Owner)?

    For now I am just thinking about stylizing the Product TITLE a certain color depending on who the Seller is.

    Answers

    #63206

    Anonymous
    @

    Hi Aaron

    Here is code that will add two class in form bm-vendor-“user id” to products:

    add_filter( ‘body_class’, ‘bb_add_class’);

    function bb_add_class($classes){
    if(is_product()){
    global $product;
    $vendor_id = WCV_Vendors::get_vendor_from_product( $product->post->ID );
    $classes[] = ‘bm-vendor-‘. $vendor_id;
    }
    return $classes;
    }

    Regards

    #63209

    Anonymous
    @

    Hi Aaron

    Forgot to tell you. Add this code to functions.php file of child theme.

    #63365
    @aaronkine

    This is GREAT!! just what i needed. Thanks!

    #65964
    @aaronkine

    Hello again… that code worked great. but now i need similar code to add a class to other pages for a specific Vendor on our site…. Let me explain what i need to accomplish…

    This is our MAIN Featured Vendor (which will not change) “Art From Scrap”. And so throughout our site we need to be able to style them differently and also make their Store and Products FIRST Listed.

    Their Vendor Page is here —> http://goodcommunities.loastage.com/vendors/art-from-scrap/
    • We need to Add a Body Class (<body class=”bm-vendor-2″) on that page also. “similar to the code you already provided”… but your code only works on the Products pages. We need to add class to this Vendor throughout the site so we can style them differently.

    • Another example: our testing site home page is here…. http://goodcommunities.loastage.com/
    we would like the (Art From Scrap) Vendor to Stay at the top (no matter what the Sort method is “Most Active, Alphabetical, Most Recent”) and also be styled differently as mentioned above
    …..Currently on the home page there are only 2 vendors on our site and both are wrapped in the same Div and Class:
    <article class=”table store-item” style=”opacity: 1;”></article> <— we need this one (Art From Scrap) to have its own Class so we can style it.
    <article class=”table store-item” style=”opacity: 1;”></article>

    Thanks for any Links or help on this.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The question ‘add page identifier (body class) for product seller’ is closed to new replies.