Created
February 16, 2015 20:28
-
-
Save maxxscho/983125f087c81be45f2f to your computer and use it in GitHub Desktop.
Replace "The Events Calendar"s loading gif
This file contains hidden or 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
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