Creating an archive page based on Advanced Custom Fields value

Hi all,

I’m putting together a cinema-based demo website using Wordpress.
On the Homepage there are two sliders - one with “Now Showing” and another with “Coming Soon” films. I’ve got this displaying correctly using a value for the Advanced Custom Field “film_status” - there are three options in total for this field which are “Now Showing”, “Coming Soon” and “Unknown”. The sliders are displaying the content according to the values associated with “film_status” for each film.

At the moment I’ve got a “View All” link underneath each slider which is just pointing through to a generic “All Films” page. I’ve played around with customising this archive by again checking the “film_status” value and doing a look-up for “Now Showing” status films only.

However, what I would like to do is have separate archive pages for “Now Showing” and “Coming Soon” - ideally with the URLs “/films/now-showing” and “/films/coming-soon”, rather than all films regardless of “film_status” value appearing on the “/films” page which is how I have it currently.

Any thoughts please?

Hi all,

Below is the HTML/PHP I currently have which pulls out all of the “Now Showing” films - as you can see the “View All” link below this loop just points to the standard “films” archive, which pulls through all films regarding of their “film_status” value.

<div class="section__slider-container text-center">

            <div class="filmpanels swiper swiper-container swiper--section swiper--section--films">

                <div class="swiper-wrapper">

                    <!-- Slides -->

                    <?php

                    $films = new WP_Query(array(

                        'post_type' => 'film'

                    ));

                    while ($films->have_posts()) {

                        $films->the_post();

                        if (get_field('film_status') == 'Now Showing') {

                    ?>

                            <div class="swiper-slide">

                                <a href="<?php the_permalink(); ?>" title="">

                                    <img src="<?php the_field('film_poster'); ?>" alt="" title="" class="swiper__imgbg" />

                                    <p><?php the_title() ?></p>

                                </a>

                            </div>

                    <?php

                        }

                    } ?>

                </div>

                <div class="swiper-button-prev"></div>

                <div class="swiper-button-next"></div>

            </div>

            <a href="<?php echo get_post_type_archive_link('film') ?>" class="cta cta--secondary">View All</a>

        </div>

Maybe one way around this is to set a marker to identify the CTA which means when the user gets through to the “film” archive, it displays either the “Now Showing” or the “Coming Soon” films? Ideally though I would like two separate pages as I think this would be best for SEO.

Please let me know if you have any thoughts.
Thanks in advance!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.