Вопрос по плагину Shortcode Ultimate

Lervshaszr

Новичок
Регистрация
15.04.2016
Сообщения
1
Здравствуйте
Вывожу с помощью этого плагина в записях слайдер. Есть у него возможность выбирать миниатюры из записей указанной категории. Надо что бы еще и сама запись выводилась. Помогите разобраться .
Вот это сам слайдер

public static function get_slides( $args ) {
$args = wp_parse_args( $args, array(
'source' => 'none',
'limit' => 20,
'gallery' => null,
'type' => '',
'link' => 'none'
) );
// Get deprecated galleries if needed
if ( $args['gallery'] !== null || ( $args['source'] === 'none' && get_option( 'su_option_galleries-432' ) ) ) return self::get_slides_432( $args );
// Prepare empty array for slides
$slides = array();
// Loop through source types
foreach ( array( 'media', 'posts', 'category', 'taxonomy' ) as $type )
if ( strpos( trim( $args['source'] ), $type . ':' ) === 0 ) {
$args['source'] = array(
'type' => $type,
'val' => (string) trim( str_replace( array( $type . ':', ' ' ), '', $args['source'] ), ',' )
);
break;
}
// Source is not parsed correctly, return empty array
if ( !is_array( $args['source'] ) ) return $slides;
// Default posts query
$query = array( 'posts_per_page' => $args['limit'] );
// Source: media
if ( $args['source']['type'] === 'media' ) {
$query['post_type'] = 'attachment';
$query['post_status'] = 'any';
$query['post__in'] = (array) explode( ',', $args['source']['val'] );
$query['orderby'] = 'post__in';
}
// Source: posts
if ( $args['source']['type'] === 'posts' ) {
if ( $args['source']['val'] !== 'recent' ) {
$query['post__in'] = (array) explode( ',', $args['source']['val'] );
$query['orderby'] = 'post__in';
}
}
// Source: category
elseif ( $args['source']['type'] === 'category' ) {
$query['category__in'] = (array) explode( ',', $args['source']['val'] );
}
// Source: taxonomy
elseif ( $args['source']['type'] === 'taxonomy' ) {
// Parse taxonomy name and terms ids
$args['source']['val'] = explode( '/', $args['source']['val'] );
// Taxonomy parsed incorrectly, return empty array
if ( !is_array( $args['source']['val'] ) || count( $args['source']['val'] ) !== 2 ) return $slides;
$query['tax_query'] = array(
array(
'taxonomy' => $args['source']['val'][0],
'field' => 'id',
'terms' => (array) explode( ',', $args['source']['val'][1] )
)
);
$query['post_type'] = 'any';
}
// Query posts
$query = new WP_Query( $query );
// Loop through posts
if ( is_array( $query->posts ) ) foreach ( $query->posts as $post ) {

// Get post thumbnail ID
$thumb = ( $args['source']['type'] === 'media' ) ? $post->ID : get_post_thumbnail_id( $post->ID );

// Thumbnail isn't set, go to next post
if ( !is_numeric( $thumb ) ) continue;
$slide = array(
'image' => wp_get_attachment_url( $thumb ),
'link' => '',
'title' => get_the_title( $post->ID )
);



if ( $args['link'] === 'image' || $args['link'] === 'lightbox' ) $slide['link'] = $slide['image'];
elseif ( $args['link'] === 'custom' ) $slide['link'] = get_post_meta( $post->ID, 'su_slide_link', true );
elseif ( $args['link'] === 'post' ) $slide['link'] = get_permalink( $post->ID );
elseif ( $args['link'] === 'attachment' ) $slide['link'] = get_attachment_link( $thumb );
$slides[] = $slide;
}
// Return slides
return $slides;
}

а это вывод его на странице
Код:
$slides = (array) Su_Tools::get_slides( $atts );
		// Loop slides
		if ( count( $slides ) ) {
			// Prepare unique ID
			$id = uniqid( 'su_slider_' );
			// Links target
			$target = ( $atts['target'] === 'yes' || $atts['target'] === 'blank' ) ? ' target="_blank"' : '';
			// Centered class
			$centered = ( $atts['centered'] === 'yes' ) ? ' su-slider-centered' : '';
			// Wheel control
			$mousewheel = ( $atts['mousewheel'] === 'yes' ) ? 'true' : 'false';
			// Prepare width and height
			$size = ( $atts['responsive'] === 'yes' ) ? 'width:100%' : 'width:' . intval( $atts['width'] ) . 'px;height:' . intval( $atts['height'] ) . 'px';
			// Add lightbox class
			if ( $atts['link'] === 'lightbox' ) $atts['class'] .= ' su-lightbox-gallery';
			// Open slider
			$return .= '<div id="' . $id . '" class="su-slider' . $centered . ' su-slider-pages-' . $atts['pages'] . ' su-slider-responsive-' . $atts['responsive'] . su_ecssc( $atts ) . '" style="' . $size . '" data-autoplay="' . $atts['autoplay'] . '" data-speed="' . $atts['speed'] . '" data-mousewheel="' . $mousewheel . '"><div class="su-slider-slides">';
			// Create slides
			foreach ( $slides as $slide ) {
				// Crop the image
				$image = su_image_resize( $slide['image'], $atts['width'], $atts['height'] );
				// Prepare slide title
				$title = ( $atts['title'] === 'yes' && $slide['title'] ) ? '<span class="su-slider-slide-title">' . stripslashes( $slide['title'] ) . '</span>' : '';
				// Open slide
				$return .= '<div class="su-slider-slide">';
				// Slide content with link
				
				if ( $slide['link'] ) $return .= '<a href="' . $slide['link'] . '"' . $target . 'title="' . esc_attr( $slide['title'] ) . '"><img src="' . $image['url'] . '" alt="' . esc_attr( $slide['title'] ) . '" />' . $title . '</a>';
				
				// Slide content without link
				else $return .= '<a><img src="' . $image['url'] . '" alt="' . esc_attr( $slide['title'] ) . '" />' . $title .  '</a>';
				// Close slide
				
				$return .= '</div>';
			}
			// Close slides
 
Верх Низ