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 | |
// Disable 'Quick Info' Entry Panel Pane in OrganizeWP | |
// @link https://organizewp.com/docs/entry-panel/ | |
add_filter( 'organizewp/entry_panel/panes/quick_info', '__return_false' ); |
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 | |
// Disable 'Actions' Entry Panel Pane in OrganizeWP | |
// @link https://organizewp.com/docs/entry-panel/ | |
add_filter( 'organizewp/entry_panel/panes/actions', '__return_false' ); |
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 | |
// Enable 'Modified' Info Column in OrganizeWP | |
// @link https://organizewp.com/docs/entries/#information-columns | |
add_filter( 'organizewp/post_type/info_columns/modified', '__return_true' ); |
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 | |
// Enable 'Author' Info Column in OrganizeWP | |
// @link https://organizewp.com/docs/entries/#information-columns | |
add_filter( 'organizewp/post_type/info_columns/author', '__return_true' ); |
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 | |
// Step 1: tell SearchWP to index Drafts, Pending, and Private entries in addition to its default post stati. | |
add_filter( 'searchwp\post_stati', function( $post_stati, $args ) { | |
$post_stati[] = 'draft'; | |
$post_stati[] = 'pending'; | |
$post_stati[] = 'private'; | |
return $post_stati; | |
}, 20, 2 ); |
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 | |
// Tell SearchWP to exclude password protected results. | |
add_filter( 'searchwp\query\mods', function( $mods ) { | |
global $wpdb; | |
$mod = new \SearchWP\Mod(); | |
$mod->set_local_table( $wpdb->posts ); | |
$mod->on( 'ID', [ 'column' => 'id' ] ); | |
$mod->raw_where_sql( function( $runtime ) { |
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 | |
// Tell SearchWP to index both value and label from ACF Select field. | |
add_filter( 'searchwp\source\post\attributes\meta', function( $meta_value, $args ) { | |
$acf_field_name = 'state'; // ACF Select field name. | |
if ( $acf_field_name !== substr( $args['meta_key'], strlen( $args['meta_key'] ) - strlen( $acf_field_name ) ) ) { | |
return $meta_value; | |
} |
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 | |
// Allow searching by WP_Post ID. | |
function swp14237_searchwp_results( $results, $attributes ) { | |
$search_query = get_search_query(); | |
if ( ! is_numeric( $search_query ) ) { | |
return $results; | |
} |
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 | |
// Modify SearchWP calculated relevance using multiplier. | |
// @link https://searchwp.com/documentation/knowledge-base/add-relevance-weight-date/ | |
class My_SearchWP_Date_Modifier { | |
private $post_type = 'post'; | |
private $meta_key = 'event_date'; | |
private $modifier_past = 0.5; | |
private $modifier_future = 1.5; | |
private $alias = 'myswpdm'; |
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 | |
// Tell SearchWP to automatically update its providers when switching sites. | |
// @link https://searchwp.com/documentation/hooks/searchwp-auto_update_providers/ | |
add_filter( 'searchwp\auto_update_providers', '__return_true' ); | |
// Retrieve results from this site. | |
$searchwp_site_1 = new \SWP_Query( [ | |
's' => 'coffee', | |
] ); |