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 | |
$attachments = new Attachments( 'attachments' ); // 'attachments' is your instance name | |
if( $attachments->exist() ) : ?> | |
<?php while( $attachments->get() ) : ?> | |
Attachments data to go here | |
<?php endwhile; ?> | |
<?php endif; ?> |
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 Term Highlight offers an alternative to the_excerpt() | |
If you're looking to generate any sort of excerpt based on one of the following: | |
- the actual excerpt | |
- the generated excerpt from the post content | |
- the post content itself | |
- string-based custom field values | |
this function is for you. It will try to find one of the above (in that order) | |
and output something with at least one search term in it (if possible) |
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 | |
// use my_search_engine instead of the default search engine when performing | |
// Job Listing searches in WP Job Manager | |
function my_searchwp_wpjmi_job_engine() { | |
return 'my_search_engine'; | |
} | |
add_filter( 'searchwp_wpjmi_job_engine', 'my_searchwp_wpjmi_job_engine' ); |
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 | |
// force SearchWP configuration to override WP Job Manager's when performing a Job Listing search | |
add_filter( 'searchwp_wpjmi_job_post_type_override', '__return_true' ); |
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 | |
// disable SearchWP integration with WP Job Manager Resume searches | |
add_filter( 'searchwp_wpjmi_hijack_resume_search', '__return_false' ); |
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 | |
// use my_other_search_engine instead of the default search engine when performing | |
// Resume searches in WP Job Manager | |
function my_searchwp_wpjmi_resume_engine() { | |
return 'my_other_search_engine'; | |
} | |
add_filter( 'searchwp_wpjmi_resume_engine', 'my_searchwp_wpjmi_resume_engine' ); |
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 | |
// force SearchWP configuration to override WP Job Manager's when performing a Job Listing search | |
add_filter( 'searchwp_wpjmi_resume_post_type_override', '__return_true' ); |
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 | |
// This code is ideally added to a child theme's functions.php | |
// OR | |
// at the *bottom* of the main theme's functions.php | |
// (do not forget to remove the opening <?php tag from this gist) | |
if( is_search() && class_exists( 'SearchWP' ) ) { | |
// remove the troublesome theme filter | |
remove_action( 'pre_get_posts', 'et_custom_posts_per_page' ); |
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 | |
if( class_exists( 'SearchWP_Term_Highlight' ) ) { | |
// instantiate the highlighter | |
$searchwp_highlighter = new SearchWP_Term_Highlight(); | |
// decipher the search query (NOTE: update the GET var if necessary) | |
$search_query = ''; | |
if( isset( $_GET['swpquery'] ) && ! empty( $_GET['swpquery'] ) ) { | |
$search_query = sanitize_text_field( urldecode( $_GET['swpquery'] ) ); |
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 | |
add_filter( 'searchwp_tax_term_or_logic', '__return_true' ); |