• Hey, I made custom post types and I want to display all of them saved as favourites in the user dashboard on FAVOURITES custom menu page. So I made it like this:

    <?php echo do_shortcode( '[user_favorites include_thumbnails="true" thumbnail_size="thumbnail"]' ); ?>

    But I need to display little bit more informations that are stored in post meta made with ACF PRO. So I don’t think that shortcode can let me do this. How can I query all posts saved as favourites by user including ACF fields on the WP user backend (custom menu page)?

    Or maybe there is any way to ad if/else in post_query like IF game is in my FAV then show it! Using simple query like:

    $args = array(  
    'post_type' => 'games',
    'post_status' => 'publish',
    'posts_per_page' => -1, 
    'orderby' => 'date', 
    'order' => 'ASC', 
    );
Viewing 1 replies (of 1 total)
  • $favs = get_user_favorites(); //fetch your favourites (it gives your favourite post ids in array)

    //loop in
    foreach($favs as $key=>$fav):
    //do your stuff
    [ get_field(‘yourstuff’, $fav)): ]
    endforeach

Viewing 1 replies (of 1 total)
  • The topic ‘Query favourites posts with some ACF fields’ is closed to new replies.