Here is a function that adds a shortcode called expire that can add a value to with date and time when content is to be hidden.
Put this shortcode in your editor: [expires hide=”2012-07-18 20:00:00″] Your content here [/expires]
This content will be hidden on the date after 20:00.
Thank you to Pontus Abrahamsson for supplying this solution on Stack Exchange forum – http://wordpress.stackexchange.com/questions/58897/how-to-display-section-for-certain-time
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
//* http://wordpress.stackexchange.com/questions/58897/how-to-display-section-for-certain-time function pa_hideafter_shortcode( $args = array(), $content = '' ) { extract( shortcode_atts( array( 'hide' => 'tomorrow', ), $args )); if ( strtotime( $hide ) > time() ) { return $content; } return ''; } add_shortcode('expires', 'pa_hideafter_shortcode'); |
Leave a Reply