Flexible Calendar dynamic
-
Hi,
I am trying make a simple jquery plugin called “flexible calendar” and fill events trough our admin with meta keys.
The tutorial is here:
https://tympanus.net/codrops/2012/11/27/calendario-a-flexible-calendar-plugin/
This example simply put one event after another like this:
var codropsEvents = { '01-01-2016' : '<span>New Year’s Day</span><span>Christmas holidays</span>' };
The tutorial is simple and works but I need to dynamically create events. And my solution is:
var codropsEvents = { <?php $day = get_post_meta($post->ID, ‘Date’, false); $i = 1; while ( $queryObject->have_posts()) : $queryObject->the_post(); ?> <?php if ( get_post_meta($post->ID, 'Date', true) !== '' ) : ?> <?php echo get_post_meta($post->ID, 'Date', true); ?> : '<span><?php echo get_title_attribute ( ) ; ?></span>', <?php endif; ?> <?php $i++; endwhile; ?> };
But the final reading of this code will generate a markup like this:
var codropsEvents = { '01-01-2016' : '<span>New Year’s Day</span>' '01-01-2016' : '<span>Christmas holidays</span>' };
The example take only the last date. So, I can see Event2 but not Event1.
How to rebuild the calendar to recognize this script … record and display all records from the day one after the other?
- The topic ‘Flexible Calendar dynamic’ is closed to new replies.