• Hi kimipooh,
    Thanks for your nice plugin.
    Is it possible to show the start and end time of the events?
    Thanks!
    Raymond

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author kimipooh

    (@kimipooh)

    You can show them by using the hook “lvgc_each_output_data”.
    https://info.cseas.kyoto-u.ac.jp/en/links-en/plugin-en/wordpress-dev-info-en/google-calendar-list-view

    If you want to output the following list on the plugin shortcode,

    Start Time – End Time (Category) Title

    Please update the plugin version 5.4 (today released).

    Then, add the attribution “hook_secret_key”.

    [gc_list_view ******* hook_secret_key=”secret key”]
    *secrey key is unuque characters.

    Add the following code to the theme’s functions.php.

    add_filter( 'lvgc_each_output_data' , 'lvgc_each_output_data_fix' , 10 , 2 );
    
    function lvgc_each_output_data_fix($out, $out_atts){
      extract($out_atts);
      $hook_secret_key = 'secrey key';
    
      $out = <<< ___EOF___
        <li class="${html_tag_class}_item"><span class="${html_tag_class}_date">$start_date_value - $end_date_value</span> $output_category_temp <a class="${html_tag_class}_link" href="$gc_link">$gc_title</a></li>
        
    ___EOF___; 
    
      return array('hook_secret_key'=>$hook_secret_key, 'data'=>$out);
    }
    • This reply was modified 5 years, 3 months ago by kimipooh.
    Thread Starter webkelder

    (@webkelder)

    Great wonderful!
    Thank you so kimipooh!

    I ended up with this (not sure its the right way but works fine):

    shortcode:

    [gc_list_view date_format="d-m-Y H.i" hook_secret_key="*****" orderbysort="ascending"]

    functions.php:

    add_filter( 'lvgc_each_output_data' , 'lvgc_each_output_data_fix' , 10 , 2 );
    function lvgc_each_output_data_fix($out, $out_atts){
      extract($out_atts);
      $hook_secret_key = '*****';
    	$startdate = substr($start_date_value, 0, 10);
    	$start_date_value_timestamp = strtotime($start_date_value);
    	$dayname = substr(date_i18n("l",$start_date_value_timestamp), 0, 2);
    	$starttime = substr($start_date_value, 11, 5);
    	$endtime = substr($end_date_value, 11, 5);
      $out = <<< ___EOF___
        <li class="${html_tag_class}_item"><span class="${html_tag_class}_date">$startdate</span> <span class="${html_tag_class}_dayname">($dayname)</span> <span class="${html_tag_class}_time">$starttime - $endtime</span> $output_category_temp <a class="${html_tag_class}_link" href="$gc_link" target="_blank">$gc_title</a></li>
        ___EOF___; 
      return array('hook_secret_key'=>$hook_secret_key, 'data'=>$out);
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘start and end time’ is closed to new replies.