Created
December 7, 2020 21:35
-
-
Save jchristopher/018c63622cd488c0ed41b024336f59d5 to your computer and use it in GitHub Desktop.
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
<?php | |
// Give Pages extraordinary weight boost to ensure Pages show up first. | |
add_filter( 'searchwp\query\mods', function( $mods ) { | |
$post_type = 'page'; | |
$source = \SearchWP\Utils::get_post_type_source_name( $post_type ); | |
$mod = new \SearchWP\Mod( $source ); | |
$mod->weight( function( $runtime ) use ( $source ) { | |
return "IF( {$runtime->get_foreign_alias()}.source = '{$source}', '999999999999', '0' )"; | |
} ); | |
$mods[] = $mod; | |
return $mods; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment