WP Logo Showcase Shortcode

Below, you’ll find a detailed guide on how to add the WP Logo Showcase Responsive Slider and Carousel Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the WP Logo Showcase Responsive Slider and Carousel Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the WP Logo Showcase Responsive Slider and Carousel Plugin and the shortcodes it provides:

Plugin Icon
WP Logo Showcase Responsive Slider and Carousel

"WP Logo Showcase Responsive Slider and Carousel is a WordPress plugin designed to display logos in a dynamic, responsive slider or carousel format. Ideal for branding and partner displays."

★★★★☆ (99) Active Installs: 50000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [logoshowcase]

WP Logo Showcase [logoshowcase] Shortcode

The wp-logo-showcase-responsive-slider-slider plugin shortcode is used to display a logo slider on your WordPress website. It handles various parameters like design, limit, autoplay, and more. This shortcode also includes compatibility checks for SiteOrigin Page Builder, Divi Frontend Builder, and Fusion Builder. It also handles RTL languages and lazy loading for optimized performance.

Shortcode: [logoshowcase]

Parameters

Here is a list of all possible logoshowcase shortcode parameters and attributes:

  • limit – Sets maximum number of logos to display.
  • design – Selects the design layout for the logo showcase.
  • cat_id – Filters logos by specific category ID.
  • cat_name – Filters logos by specific category name.
  • slides_column – Sets the number of logos to display in one slide.
  • slides_scroll – Sets the number of logos to scroll at once.
  • dots – Enables or disables navigation dots.
  • arrows – Enables or disables navigation arrows.
  • autoplay – Enables or disables automatic sliding of logos.
  • autoplay_interval – Sets time interval for automatic sliding.
  • speed – Sets speed of sliding transition.
  • center_mode – Enables or disables center mode for the slider.
  • rtl – Enables or disables right-to-left sliding.
  • loop – Enables or disables looping of the slider.
  • link_target – Sets the target for logo links.
  • show_title – Shows or hides logo title.
  • image_size – Sets the size of the logo image.
  • orderby – Determines the order of logos by specific parameter.
  • order – Sets the order of logos (ascending or descending).
  • hide_border – Hides or shows border around logos.
  • max_height – Sets maximum height of logos.
  • lazyload – Enables or disables lazy loading of images.
  • className – Adds a custom class name to the logo showcase.
  • align – Aligns the logo showcase (left, center, or right).
  • extra_class – Adds extra custom class names to the logo showcase.

Examples and Usage

Basic example – Displays a slider with default settings.

[logoshowcase]

Advanced examples

Displays a slider with a maximum of 10 logos, using design-2, and with arrows disabled.

[logoshowcase limit=10 design="design-2" arrows="false"]

Displays a slider with logos from a specific category (cat_id=3), with autoplay enabled and an autoplay interval of 4000 milliseconds.

[logoshowcase cat_id=3 autoplay="true" autoplay_interval=4000]

Displays a slider with logos ordered by title in descending order, with a maximum height of 300 pixels for each logo.

[logoshowcase orderby="title" order="DESC" max_height=300]

Displays a slider with logos in a lazyload mode set to ‘ondemand’, and with a custom class added for additional CSS styling.

[logoshowcase lazyload="ondemand" extra_class="my-custom-class"]

PHP Function Code

In case you have difficulties debugging what causing issues with [logoshowcase] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'logoshowcase', 'wpls_logo_slider' );

Shortcode PHP function:

function wpls_logo_slider( $atts, $content ) {

	global $post;

	// SiteOrigin Page Builder Gutenberg Block Tweak - Do not Display Preview
	if( isset( $_POST['action'] ) && ($_POST['action'] == 'so_panels_layout_block_preview' || $_POST['action'] == 'so_panels_builder_content_json') ) {
		return "[logoshowcase]";
	}

	// Divi Frontend Builder - Do not Display Preview
	if( function_exists( 'et_core_is_fb_enabled' ) && isset( $_POST['is_fb_preview'] ) && isset( $_POST['shortcode'] ) ) {
		return '<div class="wpls-builder-shrt-prev">
					<div class="wpls-builder-shrt-title"><span>'.esc_html__('Logo Showcase View', 'album-and-image-gallery-plus-lightbox').'</span></div>
					logoshowcase
				</div>';
	}

	// Fusion Builder Live Editor - Do not Display Preview
	if( class_exists( 'FusionBuilder' ) && (( isset( $_GET['builder'] ) && $_GET['builder'] == 'true' ) || ( isset( $_POST['action'] ) && $_POST['action'] == 'get_shortcode_render' )) ) {
		return '<div class="wpls-builder-shrt-prev">
					<div class="wpls-builder-shrt-title"><span>'.esc_html__('Logo Showcase View', 'album-and-image-gallery-plus-lightbox').'</span></div>
					logoshowcase
				</div>';
	}

	// Shortcode Parameter
	extract(shortcode_atts(array(
		'limit' 			=> 15,
		'design'			=> 'design-1',
		'cat_id'			=> '',
		'cat_name' 			=> '',
		'slides_column'		=> 4,
		'slides_scroll'		=> 1,
		'dots'				=> 'true',
		'arrows'			=> 'true',
		'autoplay'			=> 'true',
		'autoplay_interval'	=> 3000,
		'speed'				=> 800,
		'center_mode'		=> 'false',
		'rtl'				=> '',
		'loop'				=> 'true',
		'link_target'		=> 'self',
		'show_title'		=> 'false',
		'image_size'		=> 'full',
		'orderby'			=> 'date',
		'order'				=> 'ASC',
		'hide_border'		=> 'true',
		'max_height'		=> 250,
		'lazyload'			=> '', // ondemand or progressive
		'className'			=> '',
		'align'				=> '',
		'extra_class'		=> '',
	), $atts, 'logoshowcase'));

	$shortcode_designs	= wpls_logo_designs();
	$unique				= wplss_get_unique();
	$design				= array_key_exists( trim( $design ), $shortcode_designs ) ? $design 	: 'design-1';
	$limit				= ! empty( $limit ) 				? $limit 					: 15;
	$cat				= ! empty( $cat_id )				? explode( ',',$cat_id ) 	: '';
	$cat_name			= ! empty( $cat_name )				? $cat_name 				: '';
	$slides_scroll		= ! empty( $slides_scroll ) 		? $slides_scroll 			: 1;
	$dots				= ( $dots == 'false' ) 				? 'false' 					: 'true';
	$arrows				= ( $arrows == 'false' ) 			? 'false' 					: 'true';
	$autoplay			= ( $autoplay == 'false' ) 			? 'false' 					: 'true';
	$autoplay_interval	= ( $autoplay_interval !== '' ) 	? $autoplay_interval 		: 2000;
	$speed				= ! empty( $speed ) 				? $speed 					: 300;
	$loop				= ( $loop == 'false' ) 				? 'false'					: 'true';
	$link_target		= ( $link_target == 'blank' ) 		? '_blank' 					: '_self';
	$show_title			= ( $show_title == 'true' ) 		? 'true'					: 'false';
	$order				= ( strtolower($order) == 'asc' ) 	? 'ASC' 					: 'DESC';
	$orderby			= ! empty($orderby)	 				? $orderby 					: 'date';
	$hide_border		= ( $hide_border == 'true' ) 		? 'sliderimage_hide_border' : '';
	$max_height			= ! empty( $max_height ) 			? $max_height 				: 250;
	$lazyload			= ( $lazyload == 'ondemand' || $lazyload == 'progressive' ) ? $lazyload : '';
	$align				= ! empty( $align )					? 'align'.$align			: '';
	$extra_class		= $extra_class .' '. $align .' '. $className;
	$extra_class		= wpls_sanitize_html_classes( $extra_class );

	// For RTL
	if( empty( $rtl ) && is_rtl() ) {
		$rtl = 'true';
	} elseif ( $rtl == 'true' ) {
		$rtl = 'true';
	} else {
		$rtl = 'false';
	}

	// Shortcode file
	$design_file_path 	= WPLS_DIR . '/templates/' . $design . '.php';
	$design_file_path 	= file_exists( $design_file_path ) ? $design_file_path : '';

	// WP Query Parameters
	$query_args = array(
					'post_type' 		=> WPLS_POST_TYPE,
					'post_status' 		=> array( 'publish' ),
					'posts_per_page'	=> $limit,
					'order'          	=> $order,
					'orderby'        	=> $orderby,
				);

	if( $cat != "" ) {
		$query_args['tax_query'] = array(
									array( 
										'taxonomy'	=> WPLS_CAT_TYPE, 
										'field'		=> 'term_id', 
										'terms'		=> $cat,
									)
		);
	}

	// Enqueue required script
	wp_enqueue_script( 'wpos-slick-jquery' );
	wp_enqueue_script( 'wpls-public-js' );

	// WP Query Parameters
	$logo_query = new WP_Query($query_args);
	$post_count = $logo_query->post_count;

	// Slider configuration and taken care of centermode
	$slides_column 		= ( ! empty( $slides_column ) && $slides_column <= $post_count ) ? $slides_column : $post_count;
	$center_mode		= ( $center_mode == 'true' && $slides_column % 2 != 0 && $slides_column != $post_count ) ? 'true' : 'false';
	$center_mode_cls	= ( $center_mode == 'true' )	? 'wpls-center' : '';
	$dots_cls			= ( $dots == 'false' )			? 'wpls-dots-false' : '';

	// Slider configuration
	$slider_conf = compact( 'slides_column', 'slides_scroll', 'dots', 'arrows', 'autoplay', 'autoplay_interval', 'loop' , 'rtl', 'speed', 'center_mode', 'lazyload' );

	ob_start();

	// If post is there
	if( $logo_query->have_posts() ) {

		if( $cat_name != '' ) { ?>
		<h2><?php echo wp_kses_post( $cat_name ); ?></h2>
		<?php } ?>
		<style>
			#wpls-logo-showcase-slider-<?php echo esc_attr( $unique ); ?> .wpls-fix-box,
			#wpls-logo-showcase-slider-<?php echo esc_attr( $unique ); ?> .wpls-fix-box img.wp-post-image{max-height:<?php echo esc_attr( $max_height ); ?>px; }
		</style>
		<div class="wpls-wrap wpls-logo-showcase-slider-wrp wpls-logo-clearfix wpls-<?php echo esc_attr( $design.' '.$extra_class ); ?>" data-conf="<?php echo htmlspecialchars(json_encode($slider_conf)); ?>">
			<div class="wpls-logo-showcase logo_showcase wpls-logo-slider <?php echo esc_attr( $center_mode_cls ); ?> <?php echo esc_attr( $hide_border.' '.$dots_cls ); ?>" id="wpls-logo-showcase-slider-<?php echo esc_attr( $unique ); ?>" >
				<?php while ( $logo_query->have_posts() ) : $logo_query->the_post();

					$slider_orig_img	= wpls_get_logo_image( $post->ID, $image_size );
					$logourl 			= get_post_meta( $post->ID, 'wplss_slide_link', true );
					$feat_image_alt 	= get_post_meta( get_post_thumbnail_id( $post->ID ), '_wp_attachment_image_alt', true );
					$feat_image 		= $slider_orig_img;

					if ( $lazyload ) {
						$feat_image	= WPLS_URL.'assets/images/spacer.gif';
					}

					// Include shortcode html file
					if( $design_file_path ) {
						include( $design_file_path );
					}

					endwhile; ?>
			</div>
		</div>

		<?php
		wp_reset_postdata(); // Reset WP Query

		$content .= ob_get_clean();
		return $content;
	}
}

Code file location:

wp-logo-showcase-responsive-slider-slider/wp-logo-showcase-responsive-slider-slider/includes/shortcode/wpls-logo-slider.php

Conclusion

Now that you’ve learned how to embed the WP Logo Showcase Responsive Slider and Carousel Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *