Below, you’ll find a detailed guide on how to add the Gs Logo Slider Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Gs Logo Slider Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Gs Logo Slider Plugin and the shortcodes it provides:
"Logo Slider – Logo Showcase, Logo Carousel, Logo Gallery and Client Logo Presentation is a dynamic WordPress plugin. It allows you to create and manage a responsive, high-quality display of company logos on your website with a carousel slider."
- [gs_logo]
- []
Gs Logo Slider [gs_logo] Shortcode
The GS Logo Slider shortcode is a powerful tool for displaying logos on your website. It allows customization of logo display modes, slide speed, infinite loop, color, theme, and tooltip. It fetches logos based on specified categories and orders. It dynamically generates a unique ID for each logo area and applies the selected theme. Depending on the chosen theme, it loads the corresponding template file for displaying logos. Shortcode: [gs_logo]
Shortcode: [gs_logo]
Parameters
Here is a list of all possible gs_logo shortcode parameters and attributes:
gs_l_title
– Title of the logo slidergs_l_mode
– Sets the display mode for the logo slidergs_l_slide_speed
– Controls the speed of the logo slidegs_l_inf_loop
– Determines if the logos should loop infinitelygs_l_gray
– Sets the color for the logosgs_l_theme
– Sets the theme for the logo slidergs_l_tooltip
– Enables or disables tooltip on hoverorder
– Determines the order of the logosorderby
– Sets the parameter to order the logos byposts_per_page
– Sets the number of logos displayed per pagelogo_cat
– Filters the logos by categoriesid
– Unique identifier for the logo slidertheme
– Sets the display theme for the logos
Examples and Usage
Basic example – A simple usage of the gs-logo-slider plugin shortcode. This will display logos in the default settings.
[gs_logo]
Advanced examples
Displaying logos with a specific theme, in this case, ‘slider1’. The logos will be displayed in a slider format.
[gs_logo theme='slider1']
Displaying logos in a grid format with infinite loop enabled. The ‘inf_loop’ attribute is set to ‘true’, enabling the logos to loop continuously.
[gs_logo theme='grid1' inf_loop='true']
Displaying logos in a list format with a specific speed. Here, the ‘speed’ attribute is set to ‘2000’, which means the logos will change every 2 seconds.
[gs_logo theme='list1' speed='2000']
Displaying logos in a table format with a specific category. The ‘logo_cat’ attribute is set to ‘category1’, which means only logos from ‘category1’ will be displayed.
[gs_logo theme='table1' logo_cat='category1']
PHP Function Code
In case you have difficulties debugging what causing issues with [gs_logo]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'gs_logo', 'gs_logo_shortcode' );
Shortcode PHP function:
function gs_logo_shortcode( $atts ) {
$atts = shortcode_atts( gs_logo_get_shortcode_defaults(), $atts );
$atts = gslogo_change_key( $atts, 'gs_l_title', 'title' );
$atts = gslogo_change_key( $atts, 'gs_l_mode', 'mode' );
$atts = gslogo_change_key( $atts, 'gs_l_slide_speed', 'speed' );
$atts = gslogo_change_key( $atts, 'gs_l_inf_loop', 'inf_loop' );
$atts = gslogo_change_key( $atts, 'gs_l_gray', 'logo_color' );
$atts = gslogo_change_key( $atts, 'gs_l_theme', 'theme' );
$atts = gslogo_change_key( $atts, 'gs_l_tooltip', 'tooltip' );
extract( $atts );
$args = [
'order' => $order,
'orderby' => $orderby,
'posts_per_page' => $posts,
];
if ( !empty($logo_cat) ) {
$args['tax_query'] = [
[
'taxonomy' => 'logo-category',
'field' => 'slug',
'terms' => explode(',', $logo_cat),
'operator' => 'IN'
],
];
}
$GLOBALS['gs_logo_loop'] = get_gs_logo_query( $args );
$id = empty($id) ? uniqid() : sanitize_key( $id );
if ( $theme == '2rows' ) $theme = 'slider-2rows';
$classes = [
"gs_logo_area",
"gs_logo_area_$id",
$theme
];
ob_start();
?>
<div class="<?php echo implode( ' ', $classes ); ?>" style="opacity: 0; visibility: hidden;">
<div class="gs_logo_area--inner">
<?php
do_action( 'gs_logo_template_before__loaded', $theme );
if ( $theme == 'slider1' ) {
include GS_Logo_Template_Loader::locate_template( 'gs-logo-theme-slider-1.php' );
} else if ( $theme == 'grid1' ) {
include GS_Logo_Template_Loader::locate_template( 'gs-logo-theme-grid-1.php' );
} else if ( $theme == 'list1' ) {
include GS_Logo_Template_Loader::locate_template( 'gs-logo-theme-list-1.php' );
} else if ( $theme == 'table1' ) {
include GS_Logo_Template_Loader::locate_template( 'gs-logo-theme-table-1.php' );
} else if ( !gs_logo_is_pro_active() ) {
printf('<div class="gs-logo-template-upgrade"><p>%s</p></div>', __('Please upgrade to pro version to use this template', 'gslogo'));
}
do_action( 'gs_logo_template_after__loaded', $theme, $atts );
wp_reset_postdata();
?>
</div>
</div>
<?php
return ob_get_clean();
}
Code file location:
gs-logo-slider/gs-logo-slider/includes/gs-logo-shortcode.php
Gs Logo Slider [null] Shortcode
The gs-logo-slider plugin shortcode is designed to display logos in a slider format on your WordPress website. It uses the shortcode [gs_logo] to execute this function. The shortcode checks if the ID is provided. If not, it returns an error message. It also checks if the settings are available, if not, it returns an empty string. The shortcode also has a condition to load assets. If the assets are not found, it generates them for later use. If found, it stops force loading. In case of custom image size, it checks for width and crop values. If they’re missing, it sets the image size to ‘full’. Finally, it generates custom CSS if there’s any and frees up the memory.
Shortcode: [null]
Parameters
Here is a list of all possible null shortcode parameters and attributes:
id
– Unique identifier of the logo sliderpreview
– Determines if the shortcode is in preview modeimage_size
– Defines the size of the logo imagescustom_image_size_width
– Sets a custom width for the logo imagescustom_image_size_crop
– Determines if the custom-sized logo images are cropped
Examples and Usage
Basic example – Display a logo slider by referencing the ID of the slider.
[gslogo id=1 /]
For more advanced usage of the shortcode, you can include additional parameters like ‘preview’ to preview the logo slider before publishing it on your website.
Advanced examples
Display a logo slider by referencing the ID and preview the slider before publishing.
[gslogo id=1 preview=true /]
Another advanced use of the shortcode can be to display a logo slider by referencing the ID, preview the slider, and customize the image size to ‘custom’ with specific width and crop settings.
[gslogo id=1 preview=true image_size=custom custom_image_size_width=200 custom_image_size_crop=true /]
PHP Function Code
In case you have difficulties debugging what causing issues with [null]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'gslogo', 'register_gslogo_shortcode_builder' );
Shortcode PHP function:
function register_gslogo_shortcode_builder( $atts ) {
if ( empty($atts['id']) ) {
return __( 'No shortcode ID found', 'gslogo' );
}
$is_preview = ! empty($atts['preview']);
$settings = gslogo_get_temp_settings( $atts['id'], $is_preview );
if ( empty($settings) ) return '';
$settings['id'] = $atts['id'];
$settings['is_preview'] = $is_preview;
// Cache the $settings from being changed
$_settings = $settings;
// By default force mode
$force_asset_load = true;
if ( ! $is_preview && ! gs_logo_should_custom_script_render() ) {
// For Asset Generator
$main_post_id = gsLogoAssetGenerator()->get_current_page_id();
$asset_data = gsLogoAssetGenerator()->get_assets_data( $main_post_id );
if ( empty($asset_data) ) {
// Saved assets not found
// Force load the assets for first time load
// Generate the assets for later use
gsLogoAssetGenerator()->generate( $main_post_id, $_settings );
} else {
// Saved assets found
// Stop force loading the assets
// Leave the job for Asset Loader
$force_asset_load = false;
}
}
if ( isset($settings['image_size']) && $settings['image_size'] == 'custom' ) {
if ( empty( $settings['custom_image_size_width'] ) || empty( $settings['custom_image_size_width'] ) || empty( $settings['custom_image_size_crop'] ) ) {
$settings['image_size'] = 'full';
}
}
$shortcode_params = gslogo_get_shortcode_params( $settings );
ob_start();
echo do_shortcode("[gs_logo $shortcode_params]");
if ( gs_logo_should_custom_script_render() || $force_asset_load ) {
gsLogoAssetGenerator()->force_enqueue_assets( $_settings );
wp_add_inline_script( 'gs-logo-public', "jQuery(document).trigger( 'gslogo:scripts:reprocess' );jQuery(function() { jQuery(document).trigger( 'gslogo:scripts:reprocess' ) })" );
$css = gsLogoAssetGenerator()->generateCustomCss( $_settings, $_settings['id'], gs_logo_is_pro_active() );
if ( !empty($css) ) {
$css = gs_logo_minimizeCSSsimple($css);
echo "<style>".$css."</style>";
}
}
$settings = $_settings = null; // Free up the memory
return ob_get_clean();
}
Code file location:
gs-logo-slider/gs-logo-slider/includes/shortcode-builder/gs-logo-shortcode-builder-shortcode.php
Conclusion
Now that you’ve learned how to embed the Gs Logo Slider Plugin shortcodes, 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.
Leave a Reply