If checked show posts


#1

I was wondering if there’s a way to have repeat posts that only show if a multiple choice item is check? I can get it so that the posts have the yes/no default checkboxes but I’m not sure how to incorporate it into an if statement.


#2

Figured it out… kind of. It looks like on a multiple look—when your listing posts—you need to declare the choice value in the loop in order for it to show up on the dashboard. Then you can then use if/then to post those that have been checked. The problem is that the choice value posts every loop, no matter if it’s checked or not—returning true or false. If I try to declare the value inside of the #if function, it doesn’t show on the backend. SO to work around this I just put the value in a div and hid it. Now it shows up on the back end AND only posts those that come out true.

This DOESN’T show the choice in the dashboard:

{{#section projects multiple=true sortable=true required=false}}
     {{#if publish type=choice input=radio}}
           *site code*
     {{/if}}
{{/section}}

This does, but you have to hide the true/false value. It’s a work around, but it works… if you have a better suggestion, please let me know.

{{#section projects multiple=true sortable=true required=false}}
            <div style="display:none;">{{publish type=choice input=radio}}</div>
            {{#if publish type=choice input=radio}}
           *site code*
  {{/if}}
{{/section}}

#3

@jcbbuller Another option for hiding publish and other non-visible fields is to create a hidden page e.g. (_private.html) and throw them in there.

Since Vapid sums up all section fields, you can spread them across two pages.

# index.html

{{#section projects multiple=true sortable=true}}
  *site code*
{{/section}}
# _private.html

{{#section projects}}
  {{publish type=choice input=radio}}
{{/section}}

#4

Ah very nice. I love playing around with this CMS!