Support

Account

Home Forums Front-end Issues View data from another post by comparing it with the current post

Unread

View data from another post by comparing it with the current post

  • Hello all,

    I have a problem to retrieve items in WordPress with ACF.

    I have a post-type “sessions” and a post-type “movies”.

    In the post-type “sessions”, I add with a repeater (on a post-object) my movies. In the post-type “sessions”, I also give the date of the session.

    Now, what I would like is in the post-type “movies”, so on a film, indicate the dates of broadcast of the film.

    I can not do it at all. I tried stuff but nothing, I can not imagine a solution.

    Here is one of my tests. He returns ALL the sessions. I want to show ONLY the sessions or this movie is broadcast (there are several films per session).

    <?php $posts = new WP_Query( ['post_type' => 'sceances'] ); ?>
      <?php if ( $posts->have_posts() ): while ( $posts->have_posts() ): $posts->the_post(); ?>
        <?php $post_objects = get_field('sc_movies'); ?>
          <li class="diffusion-cal__item">
            <a class="diffusion-cal__link" href="<?= the_permalink(); ?>"><?php the_title() ;?> (<?= get_field('sc_date_sceance') ;?>)</a>
          </li>
      <?php endwhile; endif; ?>
    <?php wp_reset_postdata(); ?>

    Thank you very much !

Viewing 1 post (of 1 total)

The topic ‘View data from another post by comparing it with the current post’ is closed to new replies.