Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove the enclosing divs from the HTML of the event startdate, starttime, enddate and endtime.
<?php
/**
* Removes the enclosing div from the event startdate HTML.
*
* @param string $html The HTML.
* @param array $filters The template filters.
* @param WPT_Event $event The event.
* @return string The HTML without enclosing divs.
*/
function wpt_remove_startdate_divs($html, $filters, $event) {
return $event->startdate();
}
add_filter('wpt/event/startdate/html', 'wpt_remove_startdate_divs', 10 , 3);
/**
* Removes the enclosing div from the event starttime HTML.
*
* @param string $html The HTML.
* @param array $filters The template filters.
* @param WPT_Event $event The event.
* @return string The HTML without enclosing divs.
*/
function wpt_remove_starttime_divs($html, $filters, $event) {
return $event->starttime();
}
add_filter('wpt/event/starttime/html', 'wpt_remove_starttime_divs', 10 , 3);
/**
* Removes the enclosing div from the event enddate HTML.
*
* @param string $html The HTML.
* @param array $filters The template filters.
* @param WPT_Event $event The event.
* @return string The HTML without enclosing divs.
*/
function wpt_remove_enddate_divs($html, $filters, $event) {
return $event->enddate();
}
add_filter('wpt/event/enddate/html', 'wpt_remove_enddate_divs', 10 , 3);
/**
* Removes the enclosing div from the event endtime HTML.
*
* @param string $html The HTML.
* @param array $filters The template filters.
* @param WPT_Event $event The event.
* @return string The HTML without enclosing divs.
*/
function wpt_remove_endtime_divs($html, $filters, $event) {
return $event->endtime();
}
add_filter('wpt/event/endtime/html', 'wpt_remove_endtime_divs', 10 , 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment