Group by month
-
Hi,
Is it possible to group the data by month like:
February
Date 1
Date 2
Date 3March
Date 4April
Date 5
Date 6
ectThanks!
-
This topic was modified 3 years, 1 month ago by
De Werkkamer.
-
This topic was modified 3 years, 1 month ago by
-
Thank you for having an interesting my plugin.
I implemented the special shortcode option by version 6.7.
Please update the plugin on version 6.7 and set html_tag=“li-month” shortcode option.
ex. [gc_list_view html_tag=”li-month”]Awesome! Thank you!
Do you have an example how to customize this in functions.php?
you can be customized using the hook function.
For more information, please refer to “How to use Hooks” in the following document.
https://info.cseas.kyoto-u.ac.jp/en/links-en/plugin-en/wordpress-dev-info-en/google-calendar-list-viewHi,
I did use the hook function with multiple ID’s but I don’t understand how to edit li-month.
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 = 'markiezaat'; if ($id === 'screen'): $out = <<< ___EOF___ <div class="${html_tag_class}_item"> <div class="details"> <span class="title">$output_category_temp $gc_title</span> <div style="clear:both"></div> <span class="date">$start_date_value</span> <span class="desc">$description</span> </div> </div> ___EOF___; elseif ($id === 'page'): $out = <<< ___EOF___ // Here I want to edit li-month structure ___EOF___; endif; return array('hook_secret_key'=>$hook_secret_key, 'data'=>$out); }
Do I copy the code from library/tags/li-month.php, because than I get errors about $this.
Also lang=”nl” is not working. The date is still in english instead of Dutch.
Thanks!
There was a problem customizing it with hooks, so I released a fixed version, 6.7.1.
Note that the month names cannot be translated using the WordPress translation function. Therefore, month names are only available in English. If you want to make it multilingual, you need to build it in.A sample code is available at
https://info.cseas.kyoto-u.ac.jp/en/links-en/plugin-en/wordpress-dev-info-en/google-calendar-list-view
The sample code has been added to the “Notes on customizing li-month” section ofThe code shown would look like the following.
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 = 'markiezaat'; // Set a program to determine the language as follows. For Dutch, it will be nl_NL. //However, this may not be the case if you have installed multilingual plug-ins, so please check the actual value of get_locale. $lang = get_locale(); // var_dump(get_locale()); $convert_month = array( "nl_NL"=> array( "January" => "Januari", "February" => "Februari", "March" => "Maart", "April" => "April", "May" => "Mei", "June" => "Juni", "July" => "Juli", "August" => "Augustus", "September" => "Aeptember", "October" => "Oktober", "November" => "November", "December" => "December", ), ); if( !empty($month_value) && isset($convert_month[$lang])): foreach($convert_month[$lang] as $org_lang=>$con_lang): if($month_value === $org_lang): $month_value = $con_lang; break; endif; endforeach; endif; if ($id === 'screen'): $out = <<< ___EOF___ <div class="${html_tag_class}_item"> <div class="details"> <span class="title">$output_category_temp $gc_title</span> <div style="clear:both"></div> <span class="date">$start_date_value</span> <span class="desc">$description</span> </div> </div> ___EOF___; elseif ($id === 'page'): $out = ''; if($pre_start_date_month_value === $start_date_month_value): $month_value = ''; else: if( isset($month_value) && !empty($month_value) ) : $out .= <<< ___EOF___ </ul> ___EOF___; endif; endif; if( isset($month_value) && !empty($month_value) ) : $out .= <<< ___EOF___ <span style='font-weight: bold;' class='${html_tag_class}_item_month'>$month_value</span> <ul class='${html_tag_class}_item'> ___EOF___; endif; if ( isset($no_event_link) && !empty($no_event_link) ): $out .= <<< ___EOF___ <li class='${html_tag_class}_item'><span class='${html_tag_class}_date'>$start_date_value</span> $output_category_temp <span title="$gc_description_title">$gc_title</span> ___EOF___; else: $out .= <<< ___EOF___ <li class='${html_tag_class}_item'><span class='${html_tag_class}_date'>$start_date_value</span> $output_category_temp <a target="_blank" class='${html_tag_class}_link' href='$gc_link' title="$gc_description_title">$gc_title</a> ___EOF___; endif; if ( isset($view_location) && !empty($view_location) ): if( isset($view_location_name) && !empty($view_location_name) ): $location_header_name = $view_location_name; else: $location_header_name = __("Location:", $plugin_name); endif; $out .= <<< ___EOF___ <br/><span class='${html_tag_class}_location_head'>$location_header_name</span> <span class='${html_tag_class}_location'>$gc_location</span> ___EOF___; endif; $out .= <<< ___EOF___ </li> ___EOF___; endif; return array('hook_secret_key'=>$hook_secret_key, 'data'=>$out); }
Changed to apply WordPress’ translation feature for month names on version 6.7.2.
For more detail, please see “Notes on customizing li-month” section in https://info.cseas.kyoto-u.ac.jp/en/links-en/plugin-en/wordpress-dev-info-en/google-calendar-list-view .
In your functions.php code, it would look something like this.
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 = 'markiezaat'; if ($id === 'screen'): $out = <<< ___EOF___ <div class="${html_tag_class}_item"> <div class="details"> <span class="title">$output_category_temp $gc_title</span> <div style="clear:both"></div> <span class="date">$start_date_value</span> <span class="desc">$description</span> </div> </div> ___EOF___; endif; return array('hook_secret_key'=>$hook_secret_key, 'data'=>$out); }
Then, I think you set like this.
in case of “id” is “screen”, set [gc_list_view hook_secret_key =”markiezaat” id=”screen”].
in case of “id” is “page”, set [gc_list_view hook_secret_key =”markiezaat” id=”page” html_tag=”li-month”].-
This reply was modified 3 years, 1 month ago by
kimipooh.
Sorry, I didn’t have time to look at this earlier. But these updates are really great! Thank you!
-
This reply was modified 3 years, 1 month ago by
- The topic ‘Group by month’ is closed to new replies.