Support » Plugin: AMP » Outputting terms from rest api into a amp-list select

  • Resolved Chris Rault

    (@connectr)


    Hello fellow AMPers 🙂

    I recently updated our custom post type index to pull directly from the WP api using amp-list and mustache, which is working well.

    I am now working on implementing options to filter and sort the results.

    I’ve gone over every example I can find, but I can’t seem to get the taxonomy terms to output in a single select.

    The terms are being outputted, but as individual selects (you can see it in action here -> https://winefolly.staging.wpengine.com/grapes-wines/. I’ve tried every variation I can think of, but to no avail.

    Here is the code I am using to generate the select:

    <div class="container uk-text-left">
        <amp-list height="80" template="styles-list" layout="fixed-height" src="https://winefolly.staging.wpengine.com/wp-json/wp/v2/style_type/" items=".">
    		<div placeholder>Loading...</div>
            <div fallback>Failed to load wine styles</div>
            <template type="amp-mustache" id="styles-list">
            <select>
                <option value="">Filter by Style</option>
                {{#.}}
                    <option value="{{slug}}">{{name}}</option>
                {{/.}}
            </select>
        </template>
        </amp-list>
    </div>

    I’ve tried moving the selects to outside the template tag, but then the terms output as plain text and the select is empty.

    Any ideas what I’m missing?

    TIA,
    Chris

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Outputting terms from rest api into a amp-list select’ is closed to new replies.