We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Show posts in current category and specific tag Reply To: Show posts in current category and specific tag

#14107
hezuf123
Participant

Why is this not working then, even tho it gives out the format you said is needed:

$scores = get_crp_posts_id();

$rel_posts = array_column( (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 );

All it does is showing the latest posts again.

Also

$scores = get_crp_posts_id();

$rel_posts = array_column( (array) $scores, 'ID' );

print_r( $rel_posts )

Gives out the same format as

$rel_posts = array( 305512, 334934, 332645, 334067 );

print_r( $rel_posts )

So why would I need to change anything on the format? All I need is to display an array of post IDs with WPSP now or am I missing something?