Support » Plugin: My Calendar » Filter for time intervals

  • Resolved alsterb

    (@alsterb)


    Hi Joe,

    Just a quick question regarding the time intervals when setting up an event. I saw a previous thread here:

    https://wordpress.org/support/topic/amend-time-picklist/

    And I know that events have incremental times attached to them, and we want to change it from 15 minutes to 5 minutes. In the thread above it explains the manual way to do it, but also that you may have / or will be introducing a filter to add to the functions.php file. Is that filter now available and is there any info on it?

    Thanks!

    Alex

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter alsterb

    (@alsterb)

    I think I half worked this out…

    I tried this in my functions.php:

    /** Change MyCalendar time interval filters **/
    function event_interval( $interval_time ) {
        $interval_time = 5;
        return $interval_time;
    }
    
    add_filter( 'mc_interval', 'event_interval' );

    It kinda works, but I get this warning:

    warning: Cannot use a scalar value as an array in /home/example/public_html/wp-includes/class.wp-scripts.php

    I know this is my bad coding knowledge! Do you know what I’ve done wrong?

    Thanks!

    • This reply was modified 4 years, 11 months ago by alsterb.
    Thread Starter alsterb

    (@alsterb)

    Okay – think I’ve nailed it now! Had read up some more on functions / filters etc. Feeling a bit dumb…. I now have:

    /** Change MyCalendar time interval filters **/
    
    function event_interval( $interval_time ) {
        return '5';
    }
    
    add_filter( 'mc_interval', 'event_interval' );

    I think the main issue before was not putting the apostrophes around the 5 changing it from an integer to a string?

    Sorry for the rambling post like I’m talking to myself!!

    • This reply was modified 4 years, 11 months ago by alsterb.
    Plugin Author Joe Dolson

    (@joedolson)

    Glad you got it figured out!

    Best,
    Joe

    Thread Starter alsterb

    (@alsterb)

    An hour that probably would have taken you 10 seconds! lol

    We’ve used the calendar in conjunction with My Tickets and works brilliantly – thanks for all your work!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Filter for time intervals’ is closed to new replies.