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

  • Ok so I’ve thought about this a bit more and experimented with the taxonomy field type but quickly realised that I’d need a separate taxonomy from for example the default posts (e.g. tags or categories). I’m currently using the default posts for a blog part of the website so I don’t want to cross-pollinate between my custom post type and the default posts.

    I’ve tried looking into hiding the option on the default posts menu but all of the solutions result in errors in parts of the sidebar menu.

    Anyway – I resorted to going back to the tutorial Elliot created but I’m now getting an error with my foreach for some reason, no matter whether I’m viewing the standard view or the filtered view?

    https://apexcinemas.andrewcourtney.co.uk/films/
    https://apexcinemas.andrewcourtney.co.uk/films/?film_genre=Action

    Tutorial link again: https://www.advancedcustomfields.com/resources/creating-wp-archive-custom-field-filter/

    <div id=”search-filmgenre”>
    <?php

    $field = get_field_object(‘film_genre’);
    $values = explode(‘,’, $_GET[‘film_genre’]);
    $filmGenres = $field[‘choices’];

    ?>

      <?php foreach($filmGenres as $choice_value => $choice_label) : ?>

    • <input type=”checkbox” value=”<?php echo $choice_value; ?>” <?php if (in_array($choice_value, $values)) : ?>checked=”checked” <?php endif; ?> /><?php echo $choice_label; ?>
    • <?php endforeach; ?>

    </div>

    Any thoughts please? Thanks so much for your help so far.