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, not sure what happened with my code there – I think the forum misinterpreted my a tag and changed it to a link!

    <!-- 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">
                            <a name="ymal"></a>
                            <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">
                                                <a href="<?php the_permalink(); ?>" title="">
                                                    <img src="<?php echo wp_get_attachment_url(get_field('film_poster')); ?>" alt="<?php the_title() ?>" title="<?php the_title() ?>" class="swiper__imgbg" />
                                                    <p><?php the_title() ?></p>
                                                </a>
                                            </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" -->