Created
April 20, 2016 21:15
-
-
Save hauge75/4b81efaf301b27d5ad2c9876739ed9e4 to your computer and use it in GitHub Desktop.
Revisions
-
hauge75 created this gist
Apr 20, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ add_filter('relevanssi_match', 'date_weights'); function date_weights($match) { $EM_Event = em_get_event($match->doc, 'post_id'); $enddate = $EM_Event->event_end_date; $yesterday = time() - 24*60*60;; if (strtotime($enddate) > $yesterday) { $match->weight = $match->weight * 2; } else { $match->weight = $match->weight / 2; } return $match; }