开发者 | dmonnier |
---|---|
更新时间 | 2014年4月20日 02:53 |
捐献地址: | 去捐款 |
PHP版本: | 2.5 及以上 |
WordPress版本: | 3.9 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
CSSable-countdown-widget
to the /wp-content/plugins/
directoryGo to Appearances
> Widgets
and drag the CSSable Countdown widget where you want it. Expand the widget to fill out the particulars.
The shortcode is much more involved than the point-and-click interface of the widget.
The shortcode's minimum syntax is:
[countdown date="MM/DD/YYYY"]
You can specify additional options:
time
- in HH:MM:SS
format (make sure you use 24-hour time). Defaults to 00:00:00
.timezone
- in ±HH:MM
GMT format (e.g. EST is -5
, India is +5:30
, etc). Defaults to your WordPress's GMT offset as defined in Settings
> General
> Timezone
.format
- valid options are any of case-sensitive YOWDHMS
. Defaults to ydHMS
. See [*] below for more information.Y
- yearsO
- monthsW
- weeksD
- daysH
- hoursM
- minutesS
- secondssignificant
- valid options are 1 through 7. See [+] below for more information.direction
- valid options are down
and up
. Toggles countdown vs. countup timer. Defaults to down
.event
- the event description.display
- valid options are default
, list
, text
, compact
. Defaults to default
. Controls the presentation and basic styling options.expirytext
- plaintext string to display on time expired.format
is the powerhouse that controls the digits displaying on the timer. It is case-sensitive:
ydHMS
will show you years and days if they're non-zero, but hours, minutes, and seconds will always be shown. If you didn't care about the time, you could show years, months, and days with just YMD
.
[+] significant
controls how many significant digits are displayed.
Combining format
with significant
produces almost any combination of date and time values that you want displayed.
Note: you cannot set an expiration URL with the shortcode, since shortcodes are, by definition, parsed after headers are sent.
In your functions.php
file, add these lines:
wp_dequeue_style( 'cssable-countdown-style-default' ); wp_dequeue_style( 'cssable-countdown-style-list' ); wp_dequeue_style( 'cssable-countdown-style-text' );
In your functions.php
file, add these lines for every CSS file you're including:
wp_enqueue_style( 'cssable-countdown-style-YOURNAMEHERE', 'PATH/TO/CUSTOM/CSS/FILE.css' , '', '1.1' );
YOURNAMEHERE
with a unique name so it won't conflict with any other stylesheets.PATH/TO/CUSTOM/CSS/FILE.css
with the path to your CSS file. It is suggested that you put the CSS file in your themes directory and use WordPress's get_stylesheet_directory()
for your theme instead of giving it an absolute URL. Ex:wp_enqueue_style( 'cssable-countdown-style-YOURNAMEHERE', get_stylesheet_directory() . '/css/YOURCUSTOMFILE.css' , '', '1.1' );
Although the admin panel is currently only localized in English, the countdown will automatically take the language you have your WordPress set to.
time
parametermedia
property of the various wp_enqueue_style()
s to default to 'all'
instead of false
kw-jquery.countdown-1.6.3.php
to /js/
register_widgets()
because they require PHP 5.3+CSSable Countdown
expiryText
and event
expiryText
not showing if countdown was already expired on page loadexpiryURL
to expiryUrl
expiryUrl
option from shortcode since can't redirect after headers have been sentcompact
to only print if true
showExpiryTextIfExpired
optioncompact
optionexpiryText
optionsignificant
optionshowExpiryTextIfExpired
option