Custom Snippet

Use this tool to share WordPress snippets with the community.

  Save Snippet
/**
 * Replaces the default divs around the event title in all event listings.
 * 
 * @param string $html The current HTML for the event title.
 * @param WPT_Event $event The current event.
 * @return string The new HTML for the event title.
 */
function replace_event_title_divs($html, $event) {
	return '<h1><a href="'.$event->permalink().'">'.$event->title().'</a></h1>';
}
add_filter('wpt_event_title_html','replace_event_title_divs', 10, 2);

/**
 * Replaces the default divs around the event address in all event listings.
 *
 * @param string $html The current HTML for the event custom field.
 * @param string $field The name of the current custom field.
 * @param WPT_Event $event The current event.
 * @return string The new HTML for the event custom field.
 */
function replace_event_address_divs($html, $field, $event) {
	return '<div class="address">'.$event->custom('address').'</div>';
}
add_filter('wpt_event_address_html','replace_event_address_divs', 10, 3);