Top WooCommerce brands plugin for Flatsome theme by englishCode slider brand cho plugin

Code slider brand cho plugin Perfect Brands for WooCommerce dùng trên theme Flatsome

Today I want to share a code snippet for a brand slider, specifically designed for the Perfect Brands for WooCommerce plugin and used with the Flatsome theme. This code will not work with other themes without modification. You can copy and paste this code into the functions.php file of your Flatsome child theme. The code retrieves brand images and generates a slider with logos for each brand. If there are brand images available, the slider will be displayed on the website. This code snippet will help you create a visually appealing brand slider for your WooCommerce store.

Hey there! Today, I’ve got a neat piece of code to share with you. It’s a slider for brands that works with the Perfect Brands for WooCommerce plugin and specifically designed for use on the Flatsome theme. Keep in mind that if you’re using a different theme, you might need to tweak the code a bit to make it work.

Alright, let’s dive into the code. Simply copy and paste the code snippet below into the functions.php file of your Flatsome child theme.

function pmo_brands_slider()
{
    $ux_slider="[ux_slider arrows="false" freescroll="false" bullets="false"]";

    $display   = false;
    $terms     = get_terms([
        'taxonomy'   => 'pwb-brand',
        'hide_empty' => false,
    ]);

    if ($terms) {
        foreach ($terms as $term) {
            $image = get_term_meta($term->term_id, 'pwb_brand_image', true);

            if ($image) {
                $display    = true;
                $ux_slider .= '[logo hover="color" img="' . $image . '" link="' . get_term_link($term) . '" image_size="original" ]';
            }
        }
    }

    $ux_slider .= '[/ux_slider]';

    if ($display) {
        echo do_shortcode($ux_slider);
    }
}
add_shortcode('brands_slider', 'pmo_brands_slider');

And there you have it! This code snippet will allow you to create a slick brand slider on your website, perfect for showcasing your products or partners. If you’re using the Flatsome theme and the Perfect Brands for WooCommerce plugin, this is definitely worth a try. So go ahead, give it a shot and see the magic unfold!

Rate this post
See also  Guide to retrieving mail app passwords on Gmail accounts.

Related posts