Devotional Collection

Creating a devotional custom collection requires three steps:

  1. Create a custom collection form
  2. Choose and import the data into your collection
  3. Create a custom collection page, and paste in the page code

Create a custom collection form

Go to Settings -> Custom Collection, and add a custom collection.

Note: it is important that you use these exact field types and names so that the import and the code below will function properly.
  1. Form Title: Devotional
  2. Add field. Type: Date. Name the field: Date (which is the default)
  3. Add field. Type: Short Answer. Name the field: Title
  4. Add field. Type: Short Answer. Name the field: Author
  5. Add field. Type: Paragraph. Name the field: Content

Before you save the form, you'll need to enter some data into the "Settings" tab:

  1. Singular name: Devotional
  2. Identifier: devotional
  3. Icon: your choice. I suggest: glyphicons-book-open
  4. API Access: none

Now, you can save the custom collection. Notice you will also see this custom collection in your Admin sidebar. Find the new option and select it to go to the collection.

Choose and import the data into your collection

Now you get to import the content for the year that has the devotional content you want to display. We have some options below. Choose one and download it. You want to download it, not view it, so you may have to right-click and choose "download linked file". We will use this file from your computer to import to the custom collection you just made.

On your website, you will see in the sidebar, the collection name. You already clicked on it, and there you will see a list of the items in the collection. Since you just created it, you will need to import from one of the above sample data files. Click Import, and then select the file from your computer to import. Click next, and then finish. Wait till the process completes, and then you will see the list with the data imported.

 

Create a custom collection page, and paste in the page code

Now you can decide where you want the devotional page to be. You can navigate to the parent page, and then click "Create" to make a new child page at that location.

  1. Add a new page.
  2. Choose the "Custom Collection" page type.
  3. Select the template you want to use for the display page.
  4. Select the "Devotional" custom collection.
  5. Click the Edit field in the center of the page, and paste in this code into this field area. Click save, and then publish the page.

 

{% set getParamDateFormat = "Y-n-j" %}{% set today = "now"|date(getParamDateFormat) %}{% set devotionalDate = ( su.request.query.date ) ? su.request.query.date : today %}{% set dateFragment = devotionalDate|date("-m-d") %}{% set devotional = su.collection( "devotional" ).sort( "date", "desc" ).date("%"~dateFragment).limit(1).find()[0] %}{% if not devotional %}{% set devotional = random(su.collection( "devotional" ).limit(50).find()) %}{% endif %}{% set displayDate = devotionalDate|date("l, F j, Y") %}

<div class="devotional"> <h3>{{ (devotional.title) ? devotional.title : "Devotional for "~displayDate }}</h3> <div class="devotional-date">{{ displayDate }}</div> {% set hasBy = devotional.by.first or devotional.by.last %} {% set hasSource = devotional.source is not empty %} {% if hasBy or hasSource %} {% set byLine = (hasSource) ? "From "~devotional.source : "" %} {% set byIntro = (hasSource) ? " by " : "By " %} {% set byLine = (hasBy) ? byLine~byIntro~devotional.by.first~" "~devotional.by.last : byLine %} <div class="devotional-source"> {{ byLine|raw }} </div> {% endif %} <br /> <div class="devotional-content"> {{ devotional.content|markdown }} </div> <br /> {% set secondsInDay = 60 * 60 * 24 %} {% set previousDate = ( devotionalDate|date("U") - secondsInDay )|date(getParamDateFormat) %} {% set nextDate = ( devotionalDate|date("U") + secondsInDay )|date(getParamDateFormat) %} {% set path = su.request.path|split("?")[0] %} {% set previousUrl = path~"?date="~previousDate %} {% set nextUrl = path~"?date="~nextDate %} <a data-cke-saved-href="{{ previousUrl }}" href="{{ previousUrl }}">Previous</a> {% if devotionalDate != today %} | <a data-cke-saved-href="{{ path }}" href="{{ path }}">Today</a> | <a data-cke-saved-href="{{ nextUrl }}" href="{{ nextUrl }}">Next</a> {% endif %}</div>

Don't Stay Invisible.

Get noticed. Don’t blend into the background.

Take action today and start building.

SimpleUpdates.com

Support.

Getting Started, Helpful Tips, and FAQs


© Copyright 2002-2025 SimpleUpdates.com Inc., All Rights Reserved

About

Acceptable Use Policy

Privacy Policy

Terms of Service

Stay Updated!

Receive the latest news, offers, promotions, support tips and website goodness.