Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created March 5, 2019 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/ac9ffd85bc351aa64200d2531c0e1c42 to your computer and use it in GitHub Desktop.
Save billerickson/ac9ffd85bc351aa64200d2531c0e1c42 to your computer and use it in GitHub Desktop.
<?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