Last active
April 13, 2020 14:50
-
-
Save joshfeck/0e2e59c39a36b76cc65a3b92f9543c79 to your computer and use it in GitHub Desktop.
Add a tickets remaining column to the Event Espresso ticket selector. Requires displaying ticket selector details section.
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 include the opening php tag, except of course if you're starting with a blank file | |
add_action('wp_enqueue_scripts', 'my_add_inline_script_ts_show_sale_info', 20); | |
function my_add_inline_script_ts_show_sale_info() { | |
$custom_js = ' | |
jQuery(document).ready(function($){ | |
$(".ee-ticket-selector-ticket-details-th").after("<th class=\'cntr\' scope=\'col\'>Tickets Remaining</th>"); | |
$("td[data-th=\'Remaining\']").each(function() { | |
$(this).clone().insertAfter( | |
$(this).parents("tr.tckt-slctr-tkt-details-tr").prev("tr.tckt-slctr-tbl-tr").find(".tckt-slctr-tbl-td-name") | |
); | |
}); | |
});'; | |
wp_add_inline_script('ticket_selector', $custom_js); | |
} |
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 include the opening php tag, except of course if you're starting with a blank file | |
// translated version of above | |
add_action('wp_enqueue_scripts', 'my_add_inline_script_ts_show_sale_info_tr', 20); | |
function my_add_inline_script_ts_show_sale_info_tr() { | |
$custom_js = ' | |
jQuery(document).ready(function($){ | |
$(".ee-ticket-selector-ticket-details-th").after("<th class=\'cntr\' scope=\'col\'>Resterend</th>"); | |
$("td[data-th=\'Resterend\']").each(function() { | |
$(this).clone().insertAfter( | |
$(this).parents("tr.tckt-slctr-tkt-details-tr").prev("tr.tckt-slctr-tbl-tr").find(".tckt-slctr-tbl-td-name") | |
); | |
}); | |
});'; | |
wp_add_inline_script('ticket_selector', $custom_js); | |
} |
Hi,
Can you start a topic in the support forums at eventespresso.com? We can help you there.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi good day!
I tried this script, if I copy the JS itself only the heading is working, without the data in table list. If I put in PHP file, it's not working at all. Please help me in this. Thank you.