Skip to content

Instantly share code, notes, and snippets.

@morvy
Created December 26, 2021 19:01
Show Gist options
  • Save morvy/6599f5b38dc894704ed68f33c620939a to your computer and use it in GitHub Desktop.
Save morvy/6599f5b38dc894704ed68f33c620939a to your computer and use it in GitHub Desktop.
[PWB slider for Flatsome] Brands slider for Perfect WooCommerce Brands + Flatsome #flatsome #woocommerce #brands
<?php
/**
* @author Peter Morvay <[email protected]>
* @package Flatsome
* @version 3.14.3
*/
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
function pmo_brands_slider()
{
$ux_slider = '[ux_slider freescroll="false" hide_nav="true" nav_pos="outside" nav_size="normal" nav_style="simple" nav_color="dark" 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');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment