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

  • I think you need to check your code.

    For example:
    <img src="<?php echo wp_get_attachment_url(get_field('film_poster')); ?>" alt="<?php the_title() ?>" title="<?php the_title() ?>" />

    If you check the docs for wp_get_attachment_url()

    You will see it accepts an attachment ID but your ACF field is returning:

    Uses “Image URL” Return Format

    So this may explain why the images don’t work

    Checking your ‘results’ page, if you view the source, you can see:

        <section>
            <div id="search-filmgenre">
                        </div>
        </section>

    Looking at your code:

        <section>
            <div id="search-filmgenre">
                <?php
    
                // Load field settings and values.
                $field = get_field_object('film_genre');
                $filmGenres = $field['choices'];
    
                // Display labels.
                if ($filmGenres) : ?>
                    <ul>
                        <?php foreach ($filmGenres as $value => $label) : ?>
                            <li><input type="checkbox" value="<?php echo $value; ?>" <?php if (in_array($value, $filmGenres)) : ?> unchecked <?php endif; ?> /><?php echo $label; ?> </li>
                        <?php endforeach; ?>
                    </ul>
                <?php endif; ?>
            </div>
        </section>

    My thought is due to the URL, the code doesn’t trigger:
    $field = get_field_object('film_genre');

    So where have you assigned that ACF field to?