Skip to content

Instantly share code, notes, and snippets.

@maxxscho
Created February 16, 2015 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxxscho/983125f087c81be45f2f to your computer and use it in GitHub Desktop.
Save maxxscho/983125f087c81be45f2f to your computer and use it in GitHub Desktop.
Replace "The Events Calendar"s loading gif
if ( ! function_exists('bb_tribe_events_before_html_filter')) {
/**
* Replace the events calender loading gif
* @param $before
*
* @return mixed
* @author Markus Schober
*/
function bb_tribe_events_before_html_filter($before) {
$html = $before;
$doc = new DOMDocument();
$doc->loadHTML($html);
$xpath = new DOMXPath($doc);
$src = $xpath->evaluate("string(//*[@class='tribe-events-ajax-loading']/img/@src)");
$newSrc = get_stylesheet_directory_uri() . '/assets/images/loading.gif';
$before = str_replace($src, $newSrc, $before);
return $before;
}
add_filter('tribe_events_before_html', 'bb_tribe_events_before_html_filter');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment