ajax - Wordpress, wp-fullcalendar (0.8.4) with events manager (5.5.2): how to add additional text to title? -
i'm in nth hour of trying following: i'd add text/html snippets before title of event displayed in fullcalendar (i.e. inside of <div class="fc-event-title">). these snippets 1 of following:
- <span class="info">registration needed</span>
- <span class="cancelled">course cancelled</span>
- <span class="ok">held planned</span>
- blank value/no additional text
i tried copy wp-fullcalendar.php theme's directory hoping able edit function couldn't accomplish overwrite original file - anyplace tried put it.
i tried working in source file, test did (line 199 in original wp-fullcalendar.php):
$title = 'lll' . $post->post_title; did nothing output in calendar.
after while removed function 'function ajax()' wp-fullcalendar.php , calendar still displays fine. seems wrong place (which anyway it's source file, know).
i hoping find quick way accomplish task can see i'm stuck.
any on matter highly appreciated. thank you,
frank
update:
- i added custom attribute 'kurstyp' each event.
- possible values are: empty string (ie no span), 'please register', 'event cancelled', 'held planned'
- i non empty values appear within <div class="fc-event-title">
- best each wrapped in span individual class styling purposes
this added wp-fullcalendar.php:
add_action('wp_ajax_wpfc_custominfo',array('wp_fullcalendar','custominfo') ); add_action('wp_ajax_nopriv_wpfc_custominfo', array('wp_fullcalendar','custominfo') ); // , further down function custominfo() { if( !empty($_request['post_id']) ){ $return = get_post_meta($_request['post_id'], 'kurstyp', true); } echo apply_filters('wpfc_custominfo', $return); die(); } // then, inside event.render part within fullcalendar_args if(event.post_id > 0) { alert('event.title (1st): ' + event.title); var custominfo = {action: 'wpfc_custominfo', post_id: event.post_id}; var = $.ajax({ url: wpfc.ajaxurl, type: "post", data: custominfo }); extra.done(function(addtxt) { event.title = addtxt + event.title; alert('event.title (2nd): ' + event.title); }); } alert('event.title (3rd): ' + event.title);
- addtxt delivers correct value 3rd alert fires before 2nd one, event.title remains unchanged
- all of takes place in original source, i'd want change if worked
- also, if worked: how style different messages accordingly?
- might attribute classname of event object helpful , if so, how?
the texts used german, tried use english here better reading.
thanks help, frank
Comments
Post a Comment