• Resolved freedumbo

    (@freedumbo)


    Hello
    When I click 1 like, it functions well. It only show 1 post.
    But if I don’t click at all, It show all post.
    I use this code.

    $favorites = get_user_favorites();
    // Method 1: simple foreach loop
    $favorites_query = new WP_Query(array(
    ‘post_type’ => ‘post’,
    ‘posts_per_page’ => -1,
    ‘post__in’ => $favorites
    ));
    if ( $favorites_query->have_posts() ) : while ( $favorites_query->have_posts() ) : $favorites_query->the_post();

    get_template_part(‘post’, ‘featuredimage’);
    endwhile; endif; wp_reset_postdata();

    https://www.ads-software.com/plugins/favorites/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘If no like, it show all post’ is closed to new replies.