Home › Forums › Pro Support › Show posts in current category and specific tag › Reply To: Show posts in current category and specific tag
March 22, 2020 at 7:40 am
#14137
Participant
So this is works:
add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) {
if ( 1234 === $settings['list_id'] ) {
$args['post__in'] = array( 305512, 334934, 332645, 334067 );
}
return $args;
}, 10, 2 );
wpsp_display( 1234, $args );
But this doesn’t work:
$scores = get_crp_posts_id();
$rel_posts = wp_list_pluck( (array) $scores, 'ID' );
add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) {
if ( 1234 === $settings['list_id'] ) {
$args['post__in'] = $rel_posts;
}
return $args;
}, 10, 2 );
wpsp_display( 1234, $args );
And this doesn’t work either:
$scores = get_crp_posts_id();
$rel_posts = wp_list_pluck( (array) $scores, 'ID' );
$rel_posts_sep = implode(', ', $rel_posts);
add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) {
if ( 1234 === $settings['list_id'] ) {
$args['post__in'] = $rel_posts_sep;
}
return $args;
}, 10, 2 );
wpsp_display( 1234, $args );