November 01, 2017
If you have transitioning content on your website, such as a Templated Page that will be launching at a certain date or time, you can setup a custom countdown landing container, and use a custom field to automatically update the content at a scheduled date and time.
In the below example, the top .entry-content container is revealed after the countdown date is completed. The bottom .entry-content container is seen by default until the time in the custom field has elapsed.
<?php // the_date("Y-m-d"); // test the date and time format is displaying properly $countdown = date("Y-m-d"); // format for custom field: 2017-12-01 if($countdown >= get_field('date')) { // retrieve content from custom field ?> <div class="entry-content"> <?php the_field('after_countdown'); ?> </div><!-- .entry-content --> <?php } else { // default landing page ?> <div class="entry-content"> <?php the_content(); ?> <div id="countdown"></div> </div><!-- .entry-content --> <?php } ?>