Abandonment Notice: I'm afraid I simply don't have the time to maintain my Grav themes and plugins. Those interested in taking over should refer to the "Abandoned Resource Protocol". Feel free to fork and replace. So long, and thanks for all the fish.
The Scheduler Plugin is for Grav CMS. It's a simple content scheduler that hides/shows content in a page based on the date.
Installing the Scheduler plugin can be done in one of two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.
The simplest way to install this plugin is via the Grav Package Manager (GPM) through your system's terminal (also called the command line). From the root of your Grav install type:
bin/gpm install scheduler
This will install the Scheduler plugin into your /user/plugins
directory within Grav. Its files can be found under /your/site/grav/user/plugins/scheduler
.
To install this plugin, just download the zip version of this repository and unzip it under /your/site/grav/user/plugins
. Then, rename the folder to scheduler
. You can find these files on GitHub or via GetGrav.org.
You should now have all the plugin files under
/your/site/grav/user/plugins/scheduler
NOTE: This plugin is a modular component for Grav which requires Grav and the Error and Problems plugins to operate.
Before configuring this plugin, you should copy the user/plugins/scheduler/scheduler.yaml
to user/config/plugins/scheduler.yaml
and only edit that copy.
Here is the default configuration and an explanation of available options:
enabled: true
active: false
-
enabled
turns the plugin off and on. If set tofalse
, then no codes will processed at all. -
active
lets you run the plugin on a page-by-page basis. Usually you set it tofalse
in the main config, and then in pages with time-sensitive content, you put the following in the header:scheduler: active: true
This is a simple and naive content scheduler. It assumes that caching is disabled. While this plugin uses what looks like shortcodes, it does not extend the Shortcode Core infrastructure. For maximum speed, it processes the page content before the Markdown and shortcode parsers see it.
Nesting is not currently supported.
The plugin looks for content surrounded by the following codes:
[scheduler ...]
Time-sensitive content
[/schedule]
The shortcode accepts two options:
-
notbefore
is the date before which the contained content should not be displayed. -
notafter
is the date after which the contained content should not be displayed.
The dates are parsed by PHP's strtotime
(docs), so the dates can be in any format that function understands.
Here are a few sample codes:
[scheduler notbefore="2016-01-01"]
(date without a time stamp; midnight assumed)[scheduler notafter="2016-01-01T09:00:00"]
(ISO format)[scheduler notbefore="2016-01-01 09:00:00"]
(almost ISO format)[scheduler notafter="1 December 2016"]
(text date)
A live demo is available on my website.
NOTE: This plugin uses regular expressions and is relatively fragile. The matching is case insensitive, but extraneous spaces at the beginning and end of tags will cause problems.
This plugin was developed as a proof of concept for issue #1176.
- Add nesting support