Created
June 3, 2020 11:34
-
-
Save Pebblo/c678d60c553f5426fe75b25d73683fbd to your computer and use it in GitHub Desktop.
Example of how to use jQuery to add an 'empty' row when the category you select on Table View Template does not have any events.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Please do not inlue the opening PHP tag if you alread have one. | |
function tw_ee_espresso_events_table_template_empty_row() { | |
wp_add_inline_script( | |
'espresso_events_table_template', | |
'jQuery(document).ready(function($){ | |
$("#ee_filter_cat").change(function() { | |
$(".espresso-table-row.empty").remove(); | |
if( $(".espresso-table-row:visible").length === 0 ) { | |
var markup = | |
"<tr class=\"espresso-table-row empty\"><td colspan=\"4\">Sorry, there are no classes scheduled with that parameter. Please contact <a href=\"mailto:Alice@rmf.org\">Alice@rmf.org</a> for more information.</td></tr>"; | |
$("#ee_filter_table tbody").append(markup); | |
} | |
}) | |
});' | |
); | |
} | |
add_action( 'wp_enqueue_scripts', 'tw_ee_espresso_events_table_template_empty_row', 11 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment