You can easily create a staff directory custom collection, in three fairly easy steps:
- Create a custom collection form
- Add some data into your collection
- Create a custom collection page, and paste in the page code
1. Create a custom collection form
Go to Settings -> Collection Builder, and add a custom collection.
Note: it is important that you use these exact field types and names so that everything will function properly.
- Form Title: Devotional
- Add field. Type: Date. Name the field: Date (which is the default)
- Add field. Type: Short Answer. Name the field: Title
- Add field. Type: Short Answer. Name the field: Author
- Add field. Type: Paragraph. Name the field: Content
Before you save the form, you'll need to enter some data into the "Settings" tab:
- HTML Identifier: devotional
- Icon: your choice. I suggest: fa-lightbulb-o
- Singular Name: Devotional
- Title: None
- Featured image field: None
- API Access: None
Now, you can click the blue Save button at the bottom of your new custom collection. Notice you will also see this custom collection in your Admin sidebar. Find the new option there and select it to go to the collection.
2. 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" to your computer. We will use this file from your computer to import it into the custom collection you just made.
- Read the Bible through in a year: Genesis to Revelation
- Read the Bible through in a year: Some OT and NT each day
- Ellen G White Devotional: My Life Today
- North American Division Health: Health topics
- North American Division Family: Family topics
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.
3. 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.
- Add a new page.
- Choose the "Collection" page type.
- Select the layout you want to use for the page.
- Add a descriptive title like "Daily Devotional".
- Select the "Devotional" custom collection.
- Click the blue Edit field in the center of the page, and paste the code bellow into this edit area
- Click save.
- Finally, click the Publish button.
<script> var refTagger = { settings: { bibleVersion: "NIV", roundCorners: true, socialSharing: ["twitter","facebook","google"] } }; (function(d, t) { var g = d.createElement(t), s = d.getElementsByTagName(t)[0]; g.src = "//api.reftagger.com/v2/RefTagger.js"; s.parentNode.insertBefore(g, s); }(document, "script")); </script> {% 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] %} {% 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 }}<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 }}">View Today's Devotional</a> | <a data-cke-saved-href="{{ nextUrl }}" href="{{ nextUrl }}">Next ⇨</a> {% endif %} </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"> {% if devotional %} {{ devotional.content|raw|nl2br }} {% else %} No devotional has been added for this date. {% endif %} </div> <br> <a data-cke-saved-href="{{ previousUrl }}" href="{{ previousUrl }}">⇦ Previous</a> {% if devotionalDate != today %} | <a data-cke-saved-href="{{ path }}" href="{{ path }}">View Today's Devotional</a> | <a data-cke-saved-href="{{ nextUrl }}" href="{{ nextUrl }}">Next ⇨</a> {% endif %} </div>