Home Forums General Issues Get the select options to ass them into html


Get the select options to ass them into html

  • First thanks for ACF, it’s cool

    I got this funtion php code :

    global $post;
    $current_id = $post->ID;
    $output = '<div>' . get_template_part('get_search_form') . '</div>';
    $output .= '<h3 class="text-center">Ou explorez le contenu grâce aux tags...</h3>';
    $output .= '<p class="font-italic text-center text-italic">Par format, par public ou par série !</p>';
    $output .= '<div id="filters" class="select_filters mb-30">';
    $output .= '
    <div class="select-primaire">
    <select id="thematique_select" class="s-hidden">

    I got a select named “thematique_article” in a ACF field group named “filtres_article”. I cant get the options of the ACF select and put them into my front select. Can someone help me ? !

  • $filtres_articles = get_field_object(‘filtres_articles’);
    foreach ($filtres_articles[‘sub_fields’][0][‘choices’] as $choice_key => $choice_value) {

    I did it by getting the field object and then choices of every filters type.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.