Here is a simple shortcode that can be put in the
functions.php
file from the active WordPress theme. In the shortcode arguments you can specify starting time, ending time, title and title tag as well as the background colour and padding values for the div element that envelopes the announcment content.
Of course you are free to modify anything as needed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
function timed_announcement_shortcode($args = array(), $content = '') {
extract(shortcode_atts(
array(
'until' => 'tomorrow',
'from' => 'yesterday',
'title' => __('Announcement','your_theme_textdomain'),
'titletag' => 'h3',
'background' => 'lightyellow',
'padding' => '20px',
),
$args
));
if ( strtotime($from) < time() && strtotime($until) > time()) {
return '<div style="background-color: ' . $background . '; padding: ' . $padding . ';"><' . $titletag . '>' . $title . '</' . $titletag . '><p>' . $content . '</p></div>';
}
return '';
}
add_shortcode('announcement', 'timed_announcement_shortcode');





Recent am avut nevoie de un modul de chestionare și am găsit acest 




