Support

Account

Home Forums General Issues Filtering issues which remove images and filters on page Reply To: Filtering issues which remove images and filters on page

  • Sorry it’s been a few days Jarvis – thank you so much for the clear explanation and putting this together. It definitely gives me a solid foundation to build on!

    A couple of questions I had was that while testing the setup, I noticed that it would never display the message “No films found matching your criteria.” it would seem, as only the genres that are assigned to films are shown on the form – i.e. it doesn’t display ALL genres by default, regardless of whether there are films assigned or not? Just an observation though as really you wouldn’t want someone to select an option if no results were available.

    Also, on the single film page I had the genre being displayed via a simple “get_field” for the ACF “film_genre” contents, but also a “You May Also Like” section based entirely on films with the same genre – again, using the “film_genre” contents as a basis.

    <!– START “You may also like” –>
    <?php

    $filmGenre = get_field(‘film_genre’);
    // args
    $args = array(
    ‘numberposts’ => -1, // Displays ALL post
    ‘post_type’ => ‘film’, // Change to reflect the name of your custom post type
    ‘meta_key’ => ‘film_genre’, // Change to reflect the name of your custom field
    ‘meta_value’ => $filmGenre, // Change to reflect the name of the value in your custom field
    ‘post__not_in’ => array($post->ID) // Exclude current post ID
    );
    // get results
    $the_query = new WP_Query($args);
    // The Loop
    ?>
    <?php if ($the_query->have_posts()) : ?>
    <div class=”genericpage–film__details genericpage–film__details–ymal”>

    <h2>You may also like</h2>
    <!– START – You May Also Like Slider –>
    <div class=”section__slider-container text-center”>
    <div class=”filmpanels swiper swiper-container swiper–section swiper–section–filmsymal”>
    <div class=”swiper-wrapper”>
    <?php while ($the_query->have_posts()) : $the_query->the_post() ?>
    <div class=”swiper-slide”>
    ” title=””>
    ” alt=”<?php the_title() ?>” title=”<?php the_title() ?>” class=”swiper__imgbg” />
    <p><?php the_title() ?></p>

    </div>
    <?php endwhile; ?>
    </div>
    <div class=”swiper-button-prev”></div>
    <div class=”swiper-button-next”></div>
    </div>
    </div>
    <!– END – You May Also Like Slider –>
    </div>
    <?php endif; ?>
    <?php wp_reset_query(); // Restore global post data stomped by the_post().
    ?>
    <!– END – “You may also like” –>

    Thanks again; plenty for me to think about!