6

Is there a way to schedule a draft of a entry to go live?

1 Answer 1

9

If the entry is not already published, just set the Post Date to a date in the future.

Future Post

That will set the entry to what Craft calls Pending. On the entry's index, the status indicator will be orange (instead of green).

Future Entry

If the entry is already currently published, no. That'd be a feature request. I agree, it would be great to be able to "publish over" the current edition (say for a contest or what not). If you set a draft's entry to a future date, Craft will un-publish the entry and set the status to pending.

You could work around this in Twig though. Say you want to have the entry change on 11/10. Set up a new Draft, name it Will Go Live on 11/10 (or whatever). Then in your template:

{% if now|date('U') > "2015-11-10"|date('U') %}

{% set theDrafts = craft.entryRevisions.getDraftsByEntryId(entry.id) %}

{# keep the "old" entry around just in case #}
{% set oldEntry = entry %}

        {%for i in theDrafts %}

            {# look for the specific draft and set if it exists #}

            {% if i.name == "Will Go Live on 11/10" %}
                {% set entry = i %}
            {% endif %}

        {% endfor %}

{% endif %}

{# template as normal #}
 ...
1
  • 1
    Thank you for your response. The latter is the use case I am looking for... especially for single entries.
    – Taylor
    Nov 4, 2015 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.