Pop Tags


A checkbox is the tool of choice when you need a simple true/false value for filtering entries.

A good example is implementing “sticky” blog posts. Simply add a “Checkbox” field to the entries of your blog with the name sticky and make sure to mark it as optional. Then in the index page of the blog section, do something like this:

<pop:entries sticky="true">
  <h1><a href="<pop:permalink/>"><pop:title/></a></h1>
  <pop:body truncate="200" ellipsis="..."/>
<pop:entries sticky="false" limit="10">
  <h1><a href="<pop:permalink/>"><pop:title/></a></h1>
  <pop:body truncate="200" ellipsis="..."/>

Above we use the sticky name in <pop:entries> to filter all sticky entries. You can use any fields (apart from image fields or rich text fields) to filter lists of content that you pull in.

Checkbox fields can also be used to write conditional tags which will show based on the value of sticky. Here’s a small example of using the sticky checkbox in this way:

  <pop:sticky wrap="p" class="sticky">This is a sticky post</pop:sticky>
  <pop:not_sticky wrap="p" class="not-sticky">This is not a sticky post</pop:not_sticky>

Note: Both <pop:no_sticky> and <pop:not_sticky> would work, but in this case<pop:not_sticky> reads better. As always with no_ tags, the no_tag must come directly after the field it refers to.

Continue to Date Fields »