Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #7047

    permanyer
    Participant

    I would like to be able to customize the calendar passing options to the fullcalendar.io instance.
    For example, in your front-calendar.js file i added the following customization:

    defaultView:’agendaWeek’,
    weekends: false,
    allDaySlot: false,
    axisFormat: ‘h:mm a’,
    minTime: ’08:00:00′,
    maxTime: ’23:00:00′,

    It would be nice to do it without touching the plugin code, just from the theme. I tried via different ways, but i did not succeed :/

    Thank you, your plugin is the best calendar plugin anyway!!

    #7061

    Bartosz
    Keymaster

    Thx @permanyer.

    I was looking into the possibility of adding this. Tried different ways and it is possible to do, but problem is we need to pass multidimensional arrays from PHP to the calendar script which is a bit problematic.

    I’ll probably end up with a filter hook that will only allowy you to extend the script, pass additional, one-level deep array of arguments (as in your case) – instead of completely customize the args (what would be the best option).

    #7104

    Bartosz
    Keymaster

    Hmmm… forget the answer above. I thought WP l10n_print_after is smarter that json_encode(). Wrong.

    The filter hook for this is ready and working. I’m pushing an update soon.

    #7225

    permanyer
    Participant

    Oh! you made it into the 1.6.4 revision.

    So just to close up my example, now i added to my functions.php file the following code:

    
    add_filter('em_get_full_calendar_script_args', 'my_full_calendar_args');
    function my_full_calendar_args($args){
      $args['defaultView'] = 'agendaWeek';
      $args['weekends'] = false;
      $args['allDaySlot'] = false;
      $args['axisFormat'] = 'h:mm a';
      $args['minTime'] = '08:00:00';
      $args['maxTime'] = '23:00:00';
      return $args;
    }
    
    

    and the calendar get customized as expected.
    There are plenty of options here: http://fullcalendar.io/docs/
    So that was a nice tweak!!

    Thank you!

    #7226

    Bartosz
    Keymaster

    It’s all for you :)

    #8000

    bardo
    Participant

    Hello,
    Sorry for necroposting, but I was trying to achieve the exact same result. I’m using the latest version of Events Maker, but I can’t get this filter to work. I added it to the functions.php of my custom child theme, but the code is not run at all.

    I tried it both with my own code and with permanyer’s example above with no results, but my other filters and actions work fine. Do you have any idea on how to fix it?

    Thanks a lot!

    #8005

    bardo
    Participant

    As usual, after searching for hours, the answer comes by reading some more code a few minutes after posting :)

    Basically I was trying to use the em_get_full_calendar_script_args filter on the widget, but there are no filters for the widget itself, they are only used for calendars rendered through the shortcode.

    I guess my best bet is using a text widget, filtered with do_shortcode, redering an [em-full-calendar] where I can then filter em_get_full_calendar_script_args.

    Sorry for the noise! :)

    #20117

    Moebius
    Participant

    Excuse me,
    Can I format the text of all events in the calendar so, if the event’s name is too long, i can span the name into more lines than only one? As default each event is only one line heigh and so if the event is a “one day event” the space for the name is too small.
    Thank you

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.