Support

Account

Forum Replies Created

  • thanks @elliot but I think that just gets me back to my original question of how to limit that query, say to just return 3 posts (bonus points for returning random posts). It seems by default it just returns all the posts in the relationship.

    I’m basically looking for the equivalent of:

    <?php $query = new WP_Query(array(
        'posts_per_page' => 3,
        'orderby'        => 'rand',
      ));
    ?>
  • Thanks for your help @elliot! I think for now I’ll just stick with using get_field('conference_talks', false, false); as it has everything working. Maybe look into the members stuff when I have some free time.

  • so:

    $talks = get_field('conference_talks', false, false);
    print_r($talks);
    
    Array
    (
        [0] => 3997
        [1] => 3998
        [2] => 3996
        [3] => 3995
        [4] => 3994
    )

    as opposed to:

    $talks = get_field('conference_talks');
    print_r($talks);
    
    Array
    (
    )

    so it at least returns something, but it has appeared to caused some of the other custom fields to return incorrect values.

    Update:

    I guess the other fields were messed up because it was no longer return the post object and instead the post ID (aside: I’m guessing this is similar to changing the Return Format from Post Objects to Post IDs) so where before I had things like:

    $user = get_field('talk_speaker');
    the_field('talk_description');

    I now need:

    $user = get_field('talk_speaker', $post);
    the_field('talk_description', $post);

    which I have done and seems to have everything working.

Viewing 3 posts - 1 through 3 (of 3 total)