-
-
Save billerickson/ac9ffd85bc351aa64200d2531c0e1c42 to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* SearchWP Related on specific post types | |
* @see https://www.billerickson.net/code/searchwp-related-on-specific-post-types/ | |
*/ | |
function ea_swp_related_excluded_post_types( $exclude = array() ) { | |
$allowed = array( 'post', 'case', 'press_release' ); | |
$all = array_keys( get_post_types() ); | |
return array_diff( $all, $allowed ); | |
} | |
add_filter( 'searchwp_related_excluded_post_types', 'ea_swp_related_excluded_post_types' ); | |
/** | |
* SearchWP Related, metabox priority | |
* | |
*/ | |
function ea_swp_metabox_priority( $priority ) { | |
return 'low'; | |
} | |
add_filter( 'searchwp_related_meta_box_priority', 'ea_swp_metabox_priority' ); | |
/** | |
* SearchWP Related, metabox title | |
* | |
*/ | |
function ea_swp_metabox_title( $title ) { | |
return 'Related News'; | |
} | |
add_filter( 'searchwp_related_meta_box_title', 'ea_swp_metabox_title' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment