Add element count and output for no elements
-
Hi,
for this nice plugin I want to propose an additional feature which I implemented for myself on my website.I’m filtering the events shown based on a keyword I may set in the description of an event. If the keyword is there, I want to show the event in the list view, if it’s not, then i don’t want to show it, which I do by setting the output to an empty string via the
lvgc_each_output_data
hook. However, with this method themaxResults
parameter doesn’t work as intended, because it still counts events whose output is an empty string. I introduced a new parameter that counts the number of events whose output is not an empty string, and I pass that to the hook. I also added a custom output message that is displayed when there are no non-empty events.This additional feature, which doesn’t break or modifiy any other functionality of the plugin, is done by only a very small amount of additional code in
list-view-google-calendar.php
:after line 189 add:
$element_count = 0;
after line 268 add:
'element_count' => $element_count,
replace line 278 with:
$tmp = wp_kses_post($out_t['data']);
$out .= $tmp;
if (!empty($tmp)):
++$element_count;
endif;
replace line 288 with:`
if (empty($out)):
$out = "There are no events.";
endif;
Do you think it’s possible to include this into the plugin?
Best
Bannix
- The topic ‘Add element count and output for no elements’ is closed to new replies.