Skip to content

Can't loop or use if statements in template #2

@beautifulgarbage

Description

@beautifulgarbage

First off, thank you so much for putting this together! Super helpful way to get started on a WP backbone based theme.

I have been extending out the base theme you provide in this repo, but I seem to have hit a major roadblock. Currently no matter what I do I cannot loop through arrays in my templates.

Even something basic like:
{{ _.each([0,1,2,3,4], function(i) { }}
THIS IS A MEMBER
{{ }); }}

I have tried all sorts of different variations on an each loop such as {{#each data.teamMembers }} but no love so far.

In my app.js I have _.templateSettings = { interpolate: /{{=(.+?)}}/g, evaluate: /{{(.+?)}}/g, };
which should in theory allow me to loop items using something like:
{{ _.each(data.teamMembers, function(val,i){ }}

Any insight on what I may be able to do in order to loop through data coming from the model?

thanks in advance for any advice you may be able to provide!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions