{"id":176099,"date":"2011-03-01T08:00:00","date_gmt":"2011-03-01T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/2024\/02\/22\/timed-content\/"},"modified":"2025-04-29T04:22:00","modified_gmt":"2025-04-29T04:22:00","slug":"timed-content","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/timed-content\/","title":{"rendered":"Timed Content"},"content":{"rendered":"<p>The Timed Content plugin allows users to specify that a portion of a Page or Post should appear\/be visible or disappear\/be invisible based on given time characteristics. You can also make portions of a Post or Page be visible at certain dates and times; you can even set up a schedule!<\/p>\n<p>The plugin adds the following:<\/p>\n<ul>\n<li>A \u201cclient-side\u201d shortcode that allows the marking of content to appear or disappear after a given time interval; a \u201cfade\u201d effect is included.  This functionality is intended to be used for special effects only, as content marked in this manner is still visible in the HTML source and, therefore, not a secure method of hiding content.<\/li>\n<li>Two \u201cserver-side\u201d shortcodes that allow the marking of content to be visible only during specified date\/time intervals.  This functionality <strong>can<\/strong> be used as a secure method of hiding content, because the marked content will be included in the Page\/Post <strong>only<\/strong> when viewed in the specified date\/time intervals.<\/li>\n<\/ul>\n<p>A TinyMCE dialog is included to help users build the shortcodes. See the Screenshots tab for more info.<\/p>\n<h3>Examples<\/h3>\n<pre><code>[timed-content-client show=\"1:00\"]Show me after one minute.  Since we don't want a fade-in, we can leave it out of the \"show\" attribute completely.[\/timed-content-client]\n\n[timed-content-client show=\"1:00:1000\"]Show me after one minute with a 1000 millisecond (1 second) fade-in.[\/timed-content-client]\n\n[timed-content-client hide=\"1:00:1000\"]Hide me after one minute with a 1000 millisecond (1 second) fade-out.[\/timed-content-client]\n\n[timed-content-client show=\"1:00:500\" hide=\"5:00:2000\"]Show me after one minute with a 500 millisecond (a half-second) fade-in, then hide me after five minutes with a 2000 millisecond (2 seconds) fade-out.[\/timed-content-client]\n\n[timed-content-server show=\"2013-09-13 20:30:00 -0600\"]Show me starting at 8:30 PM Central Standard Time on September 13th, 2013. I will not be displayed before then.[\/timed-content-server]\n\n[timed-content-server hide=\"2013-09-13 20:30:00 America\/Chicago\"]Hide me starting at 8:30 PM Central Daylight Time (i.e., the same timezone as Chicago) on September 13th, 2013.  I will not be displayed after then[\/timed-content-server]\n\n[timed-content-server show=\"2013-09-13 20:30:00 -0600\" hide=\"2013-09-13 21:30:00 -0600\"]Show me starting at 8:30 PM Central Standard Time on September 13th, 2013, then hide me an hour later. I will not be displayed before or after then.[\/timed-content-server]\n\n[timed-content-rule id=\"164\"]Display me based on the settings for the Timed Content Rule whoseID is 164.[\/timed-content-rule]<h3>Usage<\/h3>\n<\/code><\/pre>\n<p>NOTE: All shortcodes can be built using the TinyMCE dialog.  When in doubt, use the dialog to create correctly formed shortcodes.<\/p>\n<p><strong>The timed-content-client shortcode<\/strong><\/p>\n<pre><code>[timed-content-client show=\"mm:ss:fff\" hide=\"mm:ss:fff\"]Example Text[\/timed-content-client]\n<\/code><\/pre>\n<ul>\n<li><code>show<\/code> \u2013 Specifies the time interval after loading the web page when the marked content should be displayed. The attribute consists of three parts,<br \/>\nseparated by colons: <code>mm<\/code> \u2013 minutes, <code>ss<\/code> \u2013 seconds, and <code>fff<\/code> \u2013 if greater than <code>0<\/code>, a fade-in effect lasting <code>fff<\/code> milliseconds is applied.<\/li>\n<li><code>hide<\/code> \u2013 Specifies the time interval after loading the web page when the marked content should be hidden. The attribute consists of three parts,<br \/>\nseparated by colons: <code>mm<\/code> \u2013 minutes, <code>ss<\/code> \u2013 seconds, and <code>fff<\/code> \u2013 if greater than <code>0<\/code>, a fade-out effect lasting <code>fff<\/code> milliseconds is applied.<\/li>\n<\/ul>\n<p>Both attributes are optional, but at least one attribute must be included. Leading zeros (0) are optional. The shortcode\u2019s behaviour depends on which attributes are used:<\/p>\n<ul>\n<li><code>show<\/code> only \u2013 Marked content is initially not visible, then appears <code>mm<\/code> minutes and <code>ss<\/code> seconds after loading with a <code>fff<\/code> millisecond fade-in.<\/li>\n<li><code>hide<\/code> only \u2013 Marked content is initially visible, then disappears <code>mm<\/code> minutes and <code>ss<\/code> seconds after loading with a <code>fff<\/code> millisecond fade-out.<\/li>\n<li><code>show<\/code> and <code>hide<\/code> \u2013 Marked content is initially not visible, then appears according to the values set in <code>show<\/code>, then disappears according to the values set in <code>hide<\/code>.<\/li>\n<\/ul>\n<p>Your users must have JavaScript enabled for this shortcode to work.<\/p>\n<p><strong>The timed-content-server shortcode<\/strong><\/p>\n<pre><code>[timed-content-server show=\"datetime\" hide=\"datetime\" debug=\"true|false|when_hidden\"]Example Text[\/timed-content-server]\n<\/code><\/pre>\n<ul>\n<li><code>show<\/code> \u2013 Specifies the date\/time when the marked content should start being included on the web page.<\/li>\n<li><code>hide<\/code> \u2013 Specifies the date\/time after which the marked content should stop being included on the web page.<\/li>\n<li><code>debug<\/code> \u2013 If <code>true<\/code>, adds some debugging statements to the web page as HTML comments. If <code>when_hidden<\/code>, the debugging statements are added only when the content is hidden. Defaults to <code>false<\/code>.<\/li>\n<\/ul>\n<p>The date and time are expected to be yyyy-mm-dd HH:MM (similar to ISO 8601), for example <code>2019-04-07 15:30<\/code> for April 7, 2019, 15:30. For backward compatiblity old \u201chuman readable\u201d date formats should also work, but these should not be used any longer!<\/p>\n<p>In addition you can provide a timezone in the date\/time parameter either as name or as offset like <code>2019-04-07 15:30 America\/Chicago<\/code> or <code>2019-04-07 15:30 +0200<\/code>. If you do not provide a timezone, the WordPress timezone setting will be used as default.<\/p>\n<p>Both <code>show<\/code> and <code>hide<\/code> attributes are optional, but at least one attribute must be included. The shortcode\u2019s behaviour depends on which attributes are used:<\/p>\n<ul>\n<li><code>show<\/code> only \u2013 Marked content is outputted only after the date\/time set here.<\/li>\n<li><code>hide<\/code> only \u2013 Marked content is outputted only before the date\/time set here.<\/li>\n<li><code>show<\/code> and <code>hide<\/code> \u2013 Marked content is outputted only during the time period defined by the <code>show<\/code> and <code>hide<\/code> attributes.<\/li>\n<\/ul>\n<p><strong>The timed-content-rule shortcode<\/strong><\/p>\n<pre><code>[timed-content-rule id=\"{rule_id}|{rule_name}\"]Example Text[\/timed-content-rule]\n<\/code><\/pre>\n<p>You can find the correct shortcode from the Timed Content Rules overview page, or use the TinyMCE dialog.<\/p>\n<p><strong>Testing server side rules<\/strong><\/p>\n<p>For testing the behaviour of server side rules at specific times, you may use the GET parameter <code>tctest<\/code> in an URL, followed by date and time in the format <code>YYYY-MM-DD+hh:mm:ss<\/code>. This works only you are logged in with a user which has the right to edit the displayed page or post. For example: <code>http:\/\/mysite.example?tctest=2018-02-10+19:16:00<\/code> will show the content as if it was February 10, 2018 at 19:16.<\/p>\n<h3>Developer Documentation<\/h3>\n<p><strong>Action hooks<\/strong><\/p>\n<pre><code>add_action( \"timed_content_server_show\", \"{function_name}\", {priority_level}, 4 );\n<\/code><\/pre>\n<p>Fired when the <code>[timed-content-server]<\/code> shortcode is encountered <em>AND<\/em> the content is to be displayed based on the shortcode\u2019s show\/hide attributes.  Functions using this hook should accept the following arguments in order:<\/p>\n<ul>\n<li><code>$post_id<\/code> \u2013 the ID of the currently displayed Post\/Page<\/li>\n<li><code>$show<\/code> \u2013 the value of the <code>show<\/code> attribute. If not set, defaults to \u201c1970-Jan-01 00:00:00 +000\u201d<\/li>\n<li><code>$hide<\/code> \u2013 the value of the <code>hide<\/code> attribute. If not set, defaults to \u201c2038-Jan-19 03:14:07 +000\u201d<\/li>\n<li>\n<p><code>$content<\/code> \u2013 The content enclosed by the shortcode<\/p>\n<p>add_action( \u201ctimed_content_server_hide\u201d, \u201c{function_name}\u201d, {priority_level}, 4 );<\/p>\n<\/li>\n<\/ul>\n<p>Fired when the <code>[timed-content-server]<\/code> shortcode is encountered <em>AND<\/em> the content is to be hidden based on the shortcode\u2019s show\/hide attributes.  Functions using this hook should accept the following arguments in order:<\/p>\n<ul>\n<li><code>$post_id<\/code> \u2013 the ID of the currently displayed Post\/Page<\/li>\n<li><code>$show<\/code> \u2013 the value of the <code>show<\/code> attribute. If not set, defaults to \u201c1970-Jan-01 00:00:00 +000\u201d<\/li>\n<li><code>$hide<\/code> \u2013 the value of the <code>hide<\/code> attribute. If not set, defaults to \u201c2038-Jan-19 03:14:07 +000\u201d<\/li>\n<li>\n<p><code>$content<\/code> \u2013 The content enclosed by the shortcode<\/p>\n<p>add_action( \u201ctimed_content_rule_show\u201d, \u201c{function_name}\u201d, {priority_level}, 3 );<\/p>\n<\/li>\n<\/ul>\n<p>Fired when the <code>[timed-content-rule]<\/code> shortcode is encountered <em>AND<\/em> the content is to be displayed based on the Timed Content Rule\u2019s properties.  Functions using this hook should accept the following arguments in order:<\/p>\n<ul>\n<li><code>$post_id<\/code> \u2013 the ID of the currently displayed Post\/Page<\/li>\n<li><code>$rule_id<\/code> \u2013 the ID of the Timed Content Rule being called. Use <code>get_post_meta( $rule_id )<\/code> to get the Rule\u2019s properties.<\/li>\n<li>\n<p><code>$content<\/code> \u2013 The content enclosed by the shortcode<\/p>\n<p>add_action( \u201ctimed_content_rule_hide\u201d, \u201c{function_name}\u201d, {priority_level}, 3 );<\/p>\n<\/li>\n<\/ul>\n<p>Fired when the <code>[timed-content-rule]<\/code> shortcode is encountered <em>AND<\/em> the content is to be hidden based on the Timed Content Rule\u2019s properties.  Functions using this hook should accept the following arguments in order:<\/p>\n<ul>\n<li><code>$post_id<\/code> \u2013 the ID of the currently displayed Post\/Page<\/li>\n<li><code>$rule_id<\/code> \u2013 the ID of the Timed Content Rule being called. Use <code>get_post_meta( $rule_id )<\/code> to get the Rule\u2019s properties.<\/li>\n<li><code>$content<\/code> \u2013 The content enclosed by the shortcode<\/li>\n<\/ul>\n<p><strong>Filter hooks<\/strong><\/p>\n<pre><code>timed_content_filter\n<\/code><\/pre>\n<p>Filter for any content enclosed by a Timed Content shortcode.  Implements the same filters as <code>the_content<\/code>:<\/p>\n<ul>\n<li><code>wptexturize<\/code><\/li>\n<li><code>convert_smilies<\/code><\/li>\n<li><code>convert_chars<\/code><\/li>\n<li><code>wpautop<\/code><\/li>\n<li><code>prepend_attachment<\/code><\/li>\n<li>\n<p><code>do_shortcode<\/code><\/p>\n<p>timed_content_filter_override<\/p>\n<\/li>\n<\/ul>\n<p>Replaces the <code>timed_content_filter<\/code> with another pre-existing filter to use for any content enclosed by a Timed Content shortcode.  Any function hooked into this filter must return the name of a filter (as a string).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Plugin to show or hide portions of a Page or Post based on specific date\/time characteristics.<\/p>\n","protected":false},"author":65,"featured_media":357613,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Timed Content - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"Plugin to show or hide portions of a Page or Post based on specific date\/time characteristics."},"footnotes":""},"categories":[1],"tags":[26776,6219,44444],"class_list":["post-176099","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-marketing-tool","tag-schedule","tag-timed-content"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/176099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/comments?post=176099"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/176099\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/357613"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=176099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=176099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=176099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}