Created
February 22, 2017 18:23
-
-
Save tomatillodesign/f1236ddb6e0fb53b20ad360bed7d3850 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 | |
/* | |
* CLB Custom Genesis search results page template | |
* | |
*/ | |
// Use with SearchWP and also SearchWP Term Highlight plugins | |
add_action('genesis_after_header', 'clb_search_results', 14); | |
function clb_search_results() { | |
echo '<div class="clb-custom-archive"><div class="wrap">'; | |
echo '<div class="archive-description"><h1 class="archive-title">'; | |
_e( 'Search results for', 'locale' ); ?>: "<?php the_search_query(); ?>" | |
</h1></div></div></div> | |
<?php | |
} | |
// add_action('genesis_before_loop', 'clb_add_search_form'); | |
// function clb_add_search_form() { | |
// get_search_form(); | |
// } | |
add_action('genesis_entry_content', 'clb_searchwp_custom_excerpt'); | |
function clb_searchwp_custom_excerpt() { | |
$ugly_permalink = get_permalink(); | |
$permalink = $rest = substr($ugly_permalink, 7, -1); | |
echo '<div class="search-results-permalink"><a href="' . $ugly_permalink . '">' . $permalink . '</a></div>'; | |
// echo the excerpt (designed to be used IN PLACE OF the_excerpt | |
if( function_exists( 'searchwp_term_highlight_the_excerpt_global' ) ) { | |
echo '<div class="searchwp-excerpt">'; | |
searchwp_term_highlight_the_excerpt_global(); | |
echo '...</div>'; | |
} | |
} | |
//* Remove the post content (requires HTML5 theme support) | |
remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); | |
//* Remove the entry meta in the entry footer (requires HTML5 theme support) | |
remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment