Trending/Popular Post Slider and Widget Shortcodes

Below, you’ll find a detailed guide on how to add the Trending/Popular Post Slider and Widget 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 Trending/Popular Post Slider and Widget Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Trending/Popular Post Slider and Widget Plugin and the shortcodes it provides:

Plugin Icon
Trending/Popular Post Slider and Widget

"Trending/Popular Post Slider and Widget is a dynamic WordPress plugin that showcases your most popular posts. Its interactive slider and widget features highlight trending content, enhancing user engagement."

★★★★✩ (21) Active Installs: 4000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [wtpsw_carousel]
  • [wtpsw_gridbox]
  • [wtpsw_popular_post]

Trending/Popular Post Slider and Widget [wtpsw_carousel] Shortcode

The ‘wtpsw_carousel’ shortcode from the WP Trending Post Slider and Widget plugin displays a trending post carousel on your WordPress site. It pulls the most popular posts based on views or comments and presents them in a slick, customizable carousel. This shortcode allows fine-tuning of the carousel’s behavior and appearance, including the number of posts to show, scrolling speed, autoplay settings, and more. It also ensures compatibility with various page builders by providing specific preview settings.

Shortcode: [wtpsw_carousel]

Parameters

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

  • limit – sets the maximum number of posts to display.
  • post_type – defines the type of posts to show.
  • view_by – determines the criteria for trending posts, by views or comments.
  • order – sets the order of the posts, ascending or descending.
  • design – chooses the design template for the posts.
  • showdate – controls whether to display the post’s date.
  • showauthor – controls whether to display the post’s author.
  • showcontent – controls whether to display the post’s content.
  • words_limit – sets the maximum number of words to display from the post’s content.
  • slides_to_show – sets the number of slides to show at once.
  • slides_to_scroll – sets the number of slides to scroll at once.
  • dots – controls whether to display navigation dots.
  • arrows – controls whether to display navigation arrows.
  • speed – sets the speed of the transition between slides.
  • autoplay – controls whether the slides will change automatically.
  • autoplayinterval – sets the interval between automatic slide changes.
  • show_comment_count – controls whether to display the post’s comment count.
  • hide_empty_comment_count – controls whether to hide the comment count if it’s zero.
  • className – allows adding custom CSS classes.
  • align – aligns the posts slider, left, right, or center.
  • extra_class – allows adding extra CSS classes.

Examples and Usage

Basic example – Displaying the most popular posts in a carousel format with the default settings

[wtpsw_carousel]

Advanced examples

Displaying the most popular posts in a carousel format with a limit of 5 posts, ordered by views, showing the date, author, and comment count, with an autoplay interval of 5000 milliseconds.

[wtpsw_carousel limit="5" view_by="views" showdate="true" showauthor="true" show_comment_count="true" autoplayinterval="5000"]

Displaying the most popular posts in a carousel format from a specific post type (e.g. ‘product’), with a limit of 10 posts, ordered by comments, not showing the date, author, and content, with an autoplay interval of 3000 milliseconds, and hiding the empty comment count.

[wtpsw_carousel post_type="product" limit="10" view_by="comment" showdate="false" showauthor="false" showcontent="false" autoplayinterval="3000" hide_empty_comment_count="true"]

PHP Function Code

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

Shortcode line:

add_shortcode( 'wtpsw_carousel', 'wtpsw_popular_post_carousel' );

Shortcode PHP function:

function wtpsw_popular_post_carousel( $atts, $content = null ) {

	// 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 '[wtpsw_carousel]';
	}

	// 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="wtpsw-builder-shrt-prev">
					<div class="wtpsw-builder-shrt-title"><span>'.esc_html__('Trending Post Slider - Shortcode', 'wtpsw').'</span></div>
					wtpsw_carousel
				</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="wtpsw-builder-shrt-prev">
					<div class="wtpsw-builder-shrt-title"><span>'.esc_html__('Trending Post slider - Shortcode', 'wtpsw').'</span></div>
					wtpsw_carousel
				</div>';
	}

	global $wtpsw_options, $wtpsw_model, $wtpsw_view_by, $post;

	// Enqueue required script
	wp_dequeue_script( 'wtpsw-public-script' );
	wp_enqueue_script( 'wpos-slick-jquery' );
	wp_enqueue_script( 'wtpsw-public-script' );

	// Shortcode attributes
	extract( shortcode_atts( array(	
		'limit'						=> 10,
		'post_type'					=> 'post',
		'view_by'					=> 'views',
		'order'						=> 'DESC',
		'design'					=> 'design-1',
		'showdate'					=> 'true',
		'showauthor'				=> 'true',
		'showcontent'				=> 'false',
		'words_limit'				=> 40,
		'slides_to_show'			=> 3,
		'slides_to_scroll'			=> 1,
		'dots'						=> 'true',
		'arrows'					=> 'true',
		'speed'						=> 300,
		'autoplay'					=> 'true',
		'autoplayinterval'			=> 3000,
		'show_comment_count'		=> 'true',
		'hide_empty_comment_count'	=> 'false',
		'className'					=> '',
		'align'						=> '',
		'extra_class'				=> '',
	), $atts, 'wtpsw_carousel' ) );

	$prefix						= WTPSW_META_PREFIX;
	$supported_post_types		= wtpsw_get_option( 'post_types', array() );
	$unique						= wtpsw_get_unique();
	$limit						= ( ! empty( $limit ) && is_numeric( $limit ) )	? $limit			: 10;
	$post_type					= ( ! empty( $post_type ) && in_array( $post_type, $supported_post_types ) ) ? $post_type : '';
	$view_by					= ! empty( $view_by )							? $view_by			: 'views';
	$order						= ( strtolower($order ) == 'asc' )				? 'ASC'				: 'DESC';
	$slides_to_show				= ! empty( $slides_to_show )					? $slides_to_show	: 3;
	$slides_to_scroll			= ! empty( $slides_to_scroll )					? $slides_to_scroll	: 1;
	$speed						= ! empty( $speed )								? $speed			: 300;
	$autoplayinterval			= ! empty( $autoplayinterval )					? $autoplayinterval	: 3000;
	$hide_empty_comment_count	= ( $hide_empty_comment_count == 'true' )		? true				: false;
	$align						= ! empty( $align )								? 'align'.$align	: '';
	$extra_class				= $extra_class .' '. $align .' '. $className;
	$extra_class				= wtpsw_sanitize_html_classes( $extra_class );

	// If no valid post type is found
	if(empty($post_type) ) {
		return $content;
	}

	// Slider configuration 
	$slider_conf = compact( 'dots', 'arrows', 'autoplay', 'autoplayinterval', 'speed', 'slides_to_show', 'slides_to_scroll' );

	// Order By
	if( $view_by == 'comment' ){
		$orderby = 'comment_count';
	} elseif ( $view_by == 'views' ) {
		$orderby = 'meta_value_num';
	}

	$wtpsw_view_by = $orderby; // Assign to global variable for query filter

	$post_args = array(
						'post_type'			=> $post_type,
						'posts_per_page'	=> $limit,
						'order'				=> $order,
						'orderby'			=> $orderby
					);

	if( $view_by == 'views' ) {
		$post_args['meta_key'] = $prefix.'views';
	}

	// Wrps class variables
	$main_wrap = "wtpsw-post-carousel-{$unique}";
	$main_wrap .= " {$design}";
	$main_wrap .= " {$extra_class}";

	// Filter to change query where condition
	add_filter( 'posts_where', array( $wtpsw_model, 'wtpsw_query_where' ) );

	// Query to get post
	$wtpsw_posts = $wtpsw_model->wtpsw_get_posts( $post_args );

	// Remove Filter for change query where condition
	remove_filter( 'posts_where', array( $wtpsw_model, 'wtpsw_query_where' ) );

	ob_start();

	if( $wtpsw_posts->have_posts() ) : ?>

		<div id="wtpsw-carousel-<?php echo esc_attr($unique); ?>" class="wtpsw-post-carousel wtpsw-post-slider-init <?php echo esc_attr($main_wrap); ?>" data-conf="<?php echo htmlspecialchars(json_encode($slider_conf)); ?>">

			<?php while ($wtpsw_posts->have_posts()) : $wtpsw_posts->the_post();

				global $post;
				$wtpsw_post_stats	= array();
				$post_id			= isset($post->ID) ? $post->ID : '';
				$comment_text		= wtpsw_get_comments_number( $post->ID, $hide_empty_comment_count );

				// Design file
				include( WTPSW_DIR . '/templates/carousel/design-1.php' ); 

			endwhile; ?>
		</div>

	<?php
	endif;
	wp_reset_postdata(); // Reset WP Query
	$content .= ob_get_clean();
	return $content;
}

Code file location:

wp-trending-post-slider-and-widget/wp-trending-post-slider-and-widget/includes/shortcode/wtpsw-carousel.php

Trending/Popular Post Slider and Widget [wtpsw_gridbox] Shortcode

The wp-trending-post-slider-and-widget plugin shortcode enables the display of trending posts in a grid box format. It offers customization options like limiting the number of posts, selecting post types, ordering, and design selection.

Shortcode: [wtpsw_gridbox]

Parameters

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

  • limit – determines the number of posts to display.
  • post_type – sets the type of posts to show.
  • view_by – sort posts by views or comments.
  • order – order the posts in ascending or descending.
  • design – choose the design template for posts.
  • showdate – decide whether to show the post date.
  • showauthor – choose to display the post author’s name.
  • showcontent – decide to show the post content or not.
  • words_limit – limit the number of words in the post content.
  • show_comment_count – choose to show the number of comments on the post.
  • hide_empty_comment_count – hide the comment count if there are no comments.
  • className – add a custom CSS class to the post.
  • align – align the post to the left, right, or center.
  • extra_class – add additional CSS classes to the post.

Examples and Usage

Basic example – Display the trending posts in a grid layout with default settings.

[wtpsw_gridbox]

Advanced examples

Display the top 10 trending posts in a grid layout, ordered by views in descending order (most viewed posts first).

[wtpsw_gridbox limit="10" view_by="views" order="DESC"]

Display the top 5 trending posts from the ‘product’ post type in a grid layout, ordered by comments in ascending order (posts with the least comments first), and hide posts with no comments.

[wtpsw_gridbox limit="5" post_type="product" view_by="comment" order="ASC" hide_empty_comment_count="true"]

Display the top 5 trending posts in a grid layout, with a custom design, showing the post date, author, and content, limiting the content to 30 words.

[wtpsw_gridbox limit="5" design="design-2" showdate="true" showauthor="true" showcontent="true" words_limit="30"]

PHP Function Code

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

Shortcode line:

add_shortcode( 'wtpsw_gridbox', 'wtpsw_trending_post_gridbox' );

Shortcode PHP function:

function wtpsw_trending_post_gridbox( $atts, $content = null ) {

	// 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 '[wtpsw_gridbox]';
	}

	// 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="wtpsw-builder-shrt-prev">
					<div class="wtpsw-builder-shrt-title"><span>'.esc_html__( 'Trending Post Slider - Shortcode', 'wtpsw' ).'</span></div>
					wtpsw_gridbox
				</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="wtpsw-builder-shrt-prev">
					<div class="wtpsw-builder-shrt-title"><span>'.esc_html__( 'Trending Post slider - Shortcode', 'wtpsw' ).'</span></div>
					wtpsw_gridbox
				</div>';
	}

	global $wtpsw_options, $wtpsw_model, $wtpsw_view_by, $post;

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

	// Shortcode attributes
	extract( shortcode_atts( array(	
		'limit'						=> 5,
		'post_type'					=> 'post',
		'view_by'					=> 'views',
		'order'						=> 'DESC',
		'design'					=> 'design-1',
		'showdate'					=> 'true',
		'showauthor'				=> 'true',
		'showcontent'				=> 'false',
		'words_limit'				=> 40,
		'show_comment_count'		=> 'true',
		'hide_empty_comment_count'	=> 'false',
		'className'					=> '',
		'align'						=> '',
		'extra_class'				=> '',
	), $atts, 'wtpsw_gridbox' ) );

	$prefix						= WTPSW_META_PREFIX;
	$supported_post_types		= wtpsw_get_option( 'post_types', array() );
	$post_type					= ( ! empty( $post_type ) && in_array( $post_type, $supported_post_types ) ) ? $post_type : '';
	$limit						= ( ! empty( $limit ) && is_numeric( $limit ) ) ? $limit			: 10;
	$view_by					= ! empty( $view_by )							? $view_by			: 'views';
	$order						= ( strtolower($order ) == 'asc' )				? 'ASC'				: 'DESC';
	$hide_empty_comment_count	= ( $hide_empty_comment_count == 'true' )		? true				: false;
	$align						= ! empty( $align )								? 'align'.$align	: '';
	$extra_class				= $extra_class .' '. $align .' '. $className;
	$extra_class				= wtpsw_sanitize_html_classes( $extra_class );

	// If no valid post type is found
	if( empty( $post_type )) {
		return $content;
	}

	// Count variables
	$wtpsw_count = 1;

	// Order By
	if( $view_by == 'comment' ) {
		$orderby = 'comment_count';
	} elseif ( $view_by == 'views' ) {
		$orderby = 'meta_value_num';
	}

	$wtpsw_view_by = $orderby; // Assign to global variable for query filter

	$post_args = array(
						'post_type'			=> $post_type,
						'posts_per_page'	=> $limit,
						'order'				=> $order,
						'orderby'			=> $orderby
					);

	if( $view_by == 'views' ) {
		$post_args['meta_key'] = $prefix.'views';
	}

	// Wrps class variables
	$main_wrap = "{$design}";
	$main_wrap .= " {$extra_class}";

	// Filter to change query where condition
	add_filter( 'posts_where', array( $wtpsw_model, 'wtpsw_query_where' ) );

	// Query to get post
	$wtpsw_posts = $wtpsw_model->wtpsw_get_posts( $post_args );

	// Remove Filter for change query where condition
	remove_filter( 'posts_where', array( $wtpsw_model, 'wtpsw_query_where' ) );

	ob_start();

	if( $wtpsw_posts->have_posts() ) : ?>

		<div class="wtpsw-post-grid <?php echo esc_attr($main_wrap); ?> wtpsw-clearfix">

			<?php while ($wtpsw_posts->have_posts()) : $wtpsw_posts->the_post();

				global $post;
				$wtpsw_post_stats	= array();
				$post_id			= isset($post->ID)	? $post->ID	: '';
				$comment_text		= wtpsw_get_comments_number( $post->ID, $hide_empty_comment_count );

				// Design file
				include( WTPSW_DIR . '/templates/grid-box/design-1.php' );

			$wtpsw_count++;
			endwhile; ?>
		</div>

	<?php
	endif;
	wp_reset_postdata();
	$content .= ob_get_clean();
	return $content;
}

Code file location:

wp-trending-post-slider-and-widget/wp-trending-post-slider-and-widget/includes/shortcode/wtpsw-gridbox.php

Trending/Popular Post Slider and Widget [wtpsw_popular_post] Shortcode

The wp-trending-post-slider-and-widget plugin shortcode is a tool that enables the display of trending posts in a slider format. This shortcode features multiple customization options including post type, view count, design, and speed. It also supports various page builders like SiteOrigin, Divi, and Fusion Builder.

Shortcode: [wtpsw_popular_post]

Parameters

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

  • limit – determines the maximum number of posts to display.
  • post_type – specifies the type of posts to show.
  • view_by – sets the criteria for trending posts, either by ‘views’ or ‘comments’.
  • order – sets the order of the posts, either ascending (‘ASC’) or descending (‘DESC’).
  • design – chooses the design template for the post slider.
  • showdate – decides whether to display the date of the post.
  • showauthor – decides whether to display the author of the post.
  • showcontent – decides whether to display the content of the post.
  • words_limit – sets the maximum number of words to display from the post content.
  • dots – determines whether to show navigation dots on the slider.
  • arrows – determines whether to show navigation arrows on the slider.
  • speed – sets the speed of the slider transition.
  • autoplay – decides whether the slider should autoplay.
  • autoplayinterval – sets the interval between each slide in autoplay mode.
  • show_comment_count – decides whether to display the comment count for the post.
  • hide_empty_comment_count – decides whether to hide the comment count if it’s zero.
  • className – allows adding a custom class to the slider wrapper.
  • align – sets the alignment of the slider.
  • extra_class – allows adding extra classes to the slider wrapper.

Examples and Usage

Basic example – Displays the trending post slider with default settings.

[wtpsw_popular_post]

Advanced examples

Displays the trending post slider with a limit of 5 posts, post type set to ‘product’, and ordered by views in ascending order.

[wtpsw_popular_post limit=5 post_type='product' order='ASC']

Displays the trending post slider with a limit of 10 posts, post type set to ‘post’, ordered by views in descending order, and with the design set to ‘design-2’.

[wtpsw_popular_post limit=10 post_type='post' order='DESC' design='design-2']

Displays the trending post slider with a limit of 3 posts, post type set to ‘post’, ordered by views in descending order, with the design set to ‘design-2’, and with the author and date hidden.

[wtpsw_popular_post limit=3 post_type='post' order='DESC' design='design-2' showauthor='false' showdate='false']

PHP Function Code

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

Shortcode line:

add_shortcode( 'wtpsw_popular_post', 'wtpsw_trending_post_slider' );

Shortcode PHP function:

function wtpsw_trending_post_slider( $atts, $content = null ) {

	// 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 '[wtpsw_popular_post]';
	}

	// 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="wtpsw-builder-shrt-prev">
					<div class="wtpsw-builder-shrt-title"><span>'.esc_html__( 'Trending Post Slider - Shortcode', 'wtpsw' ).'</span></div>
					wtpsw_popular_post
				</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="wtpsw-builder-shrt-prev">
					<div class="wtpsw-builder-shrt-title"><span>'.esc_html__( 'Trending Post slider - Shortcode', 'wtpsw' ).'</span></div>
					wtpsw_popular_post
				</div>';
	}

	global $wtpsw_options, $wtpsw_model, $wtpsw_view_by, $post;

	// Enqueue required script
	wp_dequeue_script( 'wtpsw-public-script' );
	wp_enqueue_script( 'wpos-slick-jquery' );
	wp_enqueue_script( 'wtpsw-public-script' );

	// Shortcode attributes
	extract( shortcode_atts( array(
		'limit'						=> 10,
		'post_type'					=> 'post',
		'view_by'					=> 'views',
		'order'						=> 'DESC',
		'design'					=> 'design-1',
		'showdate'					=> 'true',
		'showauthor'				=> 'true',
		'showcontent'				=> 'true',
		'words_limit'				=> 40,
		'dots'						=> 'true',
		'arrows'					=> 'true',
		'speed'						=> 300,
		'autoplay'					=> 'true',
		'autoplayinterval'			=> 3000,
		'show_comment_count'		=> 'true',
		'hide_empty_comment_count'	=> 'false',
		'className'					=> '',
		'align'						=> '',
		'extra_class'				=> '',
	), $atts, 'wtpsw_popular_post' ) );

	$prefix						= WTPSW_META_PREFIX;
	$unique						= wtpsw_get_unique();
	$supported_post_types		= wtpsw_get_option( 'post_types', array() );
	$post_type					= ( ! empty( $post_type ) && in_array( $post_type, $supported_post_types ) ) ? $post_type : '';
	$limit						= ( ! empty( $limit ) && is_numeric( $limit ) )		? $limit			: 10;
	$view_by					= ! empty( $view_by )								? $view_by			: 'views';
	$speed						= ! empty( $speed )									? $speed			: 300;
	$autoplayinterval			= ! empty( $autoplayinterval )						? $autoplayinterval : 3000;
	$order						= ( strtolower($order ) == 'asc' )					? 'ASC'				: 'DESC';
	$hide_empty_comment_count	= ( $hide_empty_comment_count == 'true' )			? true				: false;
	$align						= ! empty( $align )									? 'align'.$align	: '';
	$extra_class				= $extra_class .' '. $align .' '. $className;
	$extra_class				= wtpsw_sanitize_html_classes( $extra_class );

	// Return if no valid post type
	if( empty( $post_type ) ) {
		return $content;
	}

	// Slider configuration
	$slider_conf = compact( 'dots', 'arrows', 'autoplay', 'autoplayinterval', 'speed' );

	// Order By
	if( $view_by == 'comment' ) {
		$orderby = 'comment_count';
	} elseif ( $view_by == 'views' ) {
		$orderby = 'meta_value_num';
	}

	$wtpsw_view_by = $orderby; // Assign to global variable for query filter

	$post_args = array(
						'post_type'			=> $post_type,
						'posts_per_page'	=> $limit,
						'order'				=> $order,
						'orderby'			=> $orderby
					);

	if( $view_by == 'views' ) {
		$post_args['meta_key'] = $prefix.'views';
	}

	// Wrps class variables
	$main_wrap	= "wtpsw-post-slider-{$unique}";
	$main_wrap	.= " {$design}";
	$main_wrap	.= " {$extra_class}";

	// Filter to change query where condition
	add_filter( 'posts_where', array( $wtpsw_model, 'wtpsw_query_where' ) );

	// Query to get post
	$wtpsw_posts = $wtpsw_model->wtpsw_get_posts( $post_args );

	// Remove Filter for change query where condition
	remove_filter( 'posts_where', array( $wtpsw_model, 'wtpsw_query_where' ) );

	ob_start();

	if( $wtpsw_posts->have_posts() ) : ?>

		<div id="wtpsw-slider-<?php echo esc_attr( $unique ); ?>" class="wtpsw-post-slider wtpsw-post-slider-init <?php echo esc_attr( $main_wrap ); ?>" data-conf="<?php echo htmlspecialchars( json_encode( $slider_conf )); ?>">

			<?php while ($wtpsw_posts->have_posts()) : $wtpsw_posts->the_post();

				global $post;
				$wtpsw_post_stats	= array();
				$post_id			= isset($post->ID) ? $post->ID : '';
				$comment_text		= wtpsw_get_comments_number( $post->ID, $hide_empty_comment_count );

				// Design file
				include( WTPSW_DIR . "/templates/slider/design-1.php" );

			endwhile; ?>
		</div>

	<?php
	endif;
	wp_reset_postdata(); // Reset WP Query
	$content .= ob_get_clean();
	return $content;
}

Code file location:

wp-trending-post-slider-and-widget/wp-trending-post-slider-and-widget/includes/shortcode/wtpsw-slider.php

Conclusion

Now that you’ve learned how to embed the Trending/Popular Post Slider and Widget 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.

Comments

Leave a Reply

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