Forum Replies Created

Viewing 15 replies - 91 through 105 (of 220 total)
  • Plugin Author Dave Clements

    (@thewanderingbrit)

    Hi there, what do you mean by that? Do you mean that you wish you could schedule posts/pages to publish/unpublish on a schedule like this?

    Plugin Author Dave Clements

    (@thewanderingbrit)

    That’s something very different than what this plugin does. However, you could a function to check the time and redirect to a page (the home page in your case) based on certain parameters, similar to this (except that example locked the site out during certain hours).

    Plugin Author Dave Clements

    (@thewanderingbrit)

    There is a way to do this, but you need to not use the else paramter, because as you say, it will always display the else content. You need to add a second shortcode for each shortcode that you currently have, which basically accounts for the time between the previous offtime and the next ontime. So, from your example:

    [time-restrict-repeat type="weekly" onday="Saturday" offday="Saturday" ontime="10:00:00" offtime="23:00:00"]
    It’s the weekend baby!
    [/time-restrict-repeat]
    
    [time-restrict-repeat type="weekly" onday="Saturday" offday="Sunday" ontime="23:00:00" offtime="11:00:00"]
    Work sucks, drink beer.
    [/time-restrict-repeat]
    
    [time-restrict-repeat type="weekly" onday="Sunday" offday="Sunday" ontime="11:00:00" offtime="19:00:00"]
    It’s the weekend baby!
    [/time-restrict-repeat]
    Plugin Author Dave Clements

    (@thewanderingbrit)

    Wayne,

    Thanks so much for your kind and considered review. I really appreciate it.

    Plugin Author Dave Clements

    (@thewanderingbrit)

    Something like:

    function redirect_hours() {
    	if ( date( 'H:i:s', current_time( 'timestamp' ) ) > 09:00:00 && date( 'H:i:s', current_time( 'timestamp' ) ) < 17:00:00 ) {
    		wp_die( 'Sorry, the site is closed', 'Site closed' );
    	} else {
    		return;
    	}
    }
    
    do_action( 'template_redirect', 'redirect_hours' );

    Functionality plugin: https://github.com/theukedge/functionality-plugin

    • This reply was modified 7 years, 11 months ago by Dave Clements. Reason: Added function and hook
    Plugin Author Dave Clements

    (@thewanderingbrit)

    You cannot. However, doing so would be fairly easy. Use a conditional to check the time and call wp_die to display a message when the store is closed. You could put this function in your functionality plugin.

    Plugin Author Dave Clements

    (@thewanderingbrit)

    You need to treat each instance as its own shortcode, so you’re missing the closing shortcode for all but the last item. Add [/time-restrict-repeat] after each condition and it will generally do what you want.

    On the second set of shortcodes though, your start times should coincide with the ending time of the shortcodes above, so the first one should start at 08:30:00, not 08:31:00, otherwise nothing will appear between 08:30:00 and 08:31:00 (a small point, but will make things cleaner).

    Plugin Author Dave Clements

    (@thewanderingbrit)

    Your post isn’t very helpful. What does “it’s not working” mean? In general, the syntax looks correct assuming you want it to show every Friday between 1730 and 2130.

    Plugin Author Dave Clements

    (@thewanderingbrit)

    Actually, what you’re trying to do is much simpler than that. Each incidence is a single weekly recurring schedule, so no need to nest the shortcodes like you are. Just set the onday, ontime, offday and offtime for each one. Here’s the first:

    [time-restrict-repeat type="daily" ontime="16:30:00" offtime="22:00:00" onday="Monday" offday="Monday"]<div class=”tracker-maps”><iframe src=”../../../tracker-andy/fullscreen_index.php”> </iframe></div>[/time-restrict-repeat]

    Plugin Author Dave Clements

    (@thewanderingbrit)

    I do know what you mean, but I’m afraid, as it stands, there is no way to do that with the plugin. This would require an AJAX refresh of the content based on the time. As it stands, the plugin only works based on when the page loads.

    Plugin Author Dave Clements

    (@thewanderingbrit)

    Hi John,

    Try removing the line breaks between items. Each time you have two line breaks, WordPress automatically creates a paragraph tag. Do this loads of times and you get a huge gap in your page. So do something more like:

    [time-restrict-repeat type=”weekly” onday=”Monday” offday=”Monday” ontime=”05:15:00″ offtime=”06:15:00″]
    [events_list scope=”today” post_id=”26547,26552,26557,26562,26567,26572,26577,26548,26553,26558,26563,26568,26573,26578,26549,26554,26559,26564,26569,26574,26579,26550,26555,26560,26565,26570,26575,26580,26551,26556,26561,26566,26571,26576,26581″]
    <h3 style=”text-align: center;”>#_EVENTNAME: #_EVENTTIMES</h3>
    #_ATTENDEESLIST
    [/events_list]
    [/time-restrict-repeat][time-restrict-repeat type=”weekly” onday=”Tuesday” offday=”Tuesday” ontime=”05:15:00″ offtime=”06:15:00″]
    [events_list scope=”today” post_id=”26547,26552,26557,26562,26567,26572,26577,26548,26553,26558,26563,26568,26573,26578,26549,26554,26559,26564,26569,26574,26579,26550,26555,26560,26565,26570,26575,26580,26551,26556,26561,26566,26571,26576,26581″]
    <h3 style=”text-align: center;”>#_EVENTNAME: #_EVENTTIMES</h3>
    #_ATTENDEESLIST
    [/events_list]
    [/time-restrict-repeat][time-restrict-repeat type=”weekly” onday=”Wednesday” offday=”Wednesday” ontime=”05:15:00″ offtime=”06:15:00″]
    [events_list scope=”today” post_id=”26547,26552,26557,26562,26567,26572,26577,26548,26553,26558,26563,26568,26573,26578,26549,26554,26559,26564,26569,26574,26579,26550,26555,26560,26565,26570,26575,26580,26551,26556,26561,26566,26571,26576,26581″]
    <h3 style=”text-align: center;”>#_EVENTNAME: #_EVENTTIMES</h3>
    #_ATTENDEESLIST
    [/events_list]
    [/time-restrict-repeat][time-restrict-repeat type=”weekly” onday=”Thursday” offday=”Thursday” ontime=”05:15:00″ offtime=”06:15:00″]
    [events_list scope=”today” post_id=”26547,26552,26557,26562,26567,26572,26577,26548,26553,26558,26563,26568,26573,26578,26549,26554,26559,26564,26569,26574,26579,26550,26555,26560,26565,26570,26575,26580,26551,26556,26561,26566,26571,26576,26581″]
    <h3 style=”text-align: center;”>#_EVENTNAME: #_EVENTTIMES</h3>
    #_ATTENDEESLIST
    [/events_list]
    [/time-restrict-repeat][time-restrict-repeat type=”weekly” onday=”Friday” offday=”Friday” ontime=”05:15:00″ offtime=”06:15:00″]
    [events_list scope=”today” post_id=”26547,26552,26557,26562,26567,26572,26577,26548,26553,26558,26563,26568,26573,26578,26549,26554,26559,26564,26569,26574,26579,26550,26555,26560,26565,26570,26575,26580,26551,26556,26561,26566,26571,26576,26581″]
    <h3 style=”text-align: center;”>#_EVENTNAME: #_EVENTTIMES</h3>
    #_ATTENDEESLIST
    [/events_list]
    [/time-restrict-repeat][time-restrict-repeat type=”weekly” onday=”Tuesday” offday=”Tuesday” ontime=”06:15:00″ offtime=”08:00:00″]
    [events_list scope=”today” post_id=”26634,26639,26644,26649,26654,26659,26664,26635,26640,26645,26650,26655,26660,26665,26636,26641,26646,26651,26656,26661,26666,26637,26642,26647,26652,26657,26662,26667,26638,26643,26648,26653,26658,26663,26668″]
    <h3 style=”text-align: center;”>#_EVENTNAME: #_EVENTTIMES</h3>
    #_ATTENDEESLIST
    [/events_list]
    [/time-restrict-repeat][time-restrict-repeat type=”weekly” onday=”Tuesday” offday=”Tuesday” ontime=”06:15:00″ offtime=”08:00:00″]
    [events_list scope=”today” post_id=”26634,26639,26644,26649,26654,26659,26664,26635,26640,26645,26650,26655,26660,26665,26636,26641,26646,26651,26656,26661,26666,26637,26642,26647,26652,26657,26662,26667,26638,26643,26648,26653,26658,26663,26668″]
    <h3 style=”text-align: center;”>#_EVENTNAME: #_EVENTTIMES</h3>
    #_ATTENDEESLIST
    [/events_list]
    [/time-restrict-repeat]

    Plugin Author Dave Clements

    (@thewanderingbrit)

    Hey there,

    Thanks for letting me know. The examples are in good shape: it just happens sometimes when you copy code around between different editors and when you paste code as text.

    Your latest shortcodes look perfect. And I’m baffled as to how it can parse one shortcode and not the other. My shortcode definitely allows and parses other shortcodes within it. Are you saying that when you use this shortcode, it parses the time-restrict shortcode, but not the other contained within? Or it parses neither shortcode?

    Plugin Author Dave Clements

    (@thewanderingbrit)

    Hi,

    This plugin does allow for enclosing/nesting other shortcodes. You can see that here, where whatever is inside my shortcode has shortcodes processed by do_shortcode(). I’m not sure if this is the way you wrote down the code, or the way it got pasted here, but I noticed that you have some “curly quotes” in your code. Make sure you use true double quotes. Also, I’ve never seen that date/time notation before. Make sure if it’s a supported format.

    Plugin Author Dave Clements

    (@thewanderingbrit)

    It’s my pleasure. Always glad to help.

    Disclaimer: not all support threads may get answered quite so quickly ??

    Plugin Author Dave Clements

    (@thewanderingbrit)

    Hi there,

    Actually, since the plugin uses strtotime() to calculate the dates, you can do some pretty creative stuff (including exactly what you’re requesting). For example, you can do the fourth Thursday of November this year to get Thanksgiving Day. strtotime() also supports calculations, so you can get 2 weeks before Thanksgiving, either by saying second Thursday of November this year or fourth Thursday of November this year - 2 weeks. I believe that you would do this using the [time-restrict] shortcode instead of [time-restrict-repeat], because it says this year in the string, so as soon as the next year rools around, it will start looking towards the coming November, rather than the one that just passed.

    A really useful tool for testing your inputs is PHP strtotime() Testing tool.

    I hope that helps ?? Do some testing and let me know your results.

    • This reply was modified 8 years, 1 month ago by Dave Clements. Reason: Added missing backticks for code blocks
    • This reply was modified 8 years, 1 month ago by Dave Clements. Reason: Syntax for strtotime requires fourth, not 4th
Viewing 15 replies - 91 through 105 (of 220 total)