Skip to content

Instantly share code, notes, and snippets.

@hauge75
Created April 20, 2016 21:15
Show Gist options
  • Select an option

  • Save hauge75/4b81efaf301b27d5ad2c9876739ed9e4 to your computer and use it in GitHub Desktop.

Select an option

Save hauge75/4b81efaf301b27d5ad2c9876739ed9e4 to your computer and use it in GitHub Desktop.

Revisions

  1. hauge75 created this gist Apr 20, 2016.
    14 changes: 14 additions & 0 deletions functions.php
    Original 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;
    }