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

#14185
hezuf123
Participant

So this:

$scores = get_crp_posts_id();

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

add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) {
    if ( 340019 === $settings['list_id'] ) {
        $args['post__in'] = $rel_posts;
    }

    // This should output your IDS for the post__in value.
    var_dump($args);

    return $args;
}, 10, 2 );

wpsp_display( 340019, $args );

Gives out this:

array(7) { [“order”]=> string(4) “desc” [“orderby”]=> string(4) “date” [“post_type”]=> string(4) “post” [“posts_per_page”]=> int(3) [“post_status”]=> array(1) { [0]=> string(7) “publish” } [“post__not_in”]=> array(1) { [0]=> int(340029) } [“post__in”]=> NULL }

And

$scores = get_crp_posts_id();

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

var_dump($rel_posts)

Gives out:

array(4) { [0]=> string(6) “305637” [1]=> string(6) “337823” [2]=> string(6) “340106” [3]=> string(6) “339780” }

Which are the 4 IDs I want to display.

I am using GP elements to insert the snippet on the page by the way.

  • This reply was modified 1 year, 1 month ago by hezuf123.
  • This reply was modified 1 year, 1 month ago by hezuf123.