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 | |
/** | |
* The template for displaying search results pages. | |
* | |
* @package _s | |
*/ | |
get_header(); ?> | |
<div id="primary" class="contents-search-results"> |
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 | |
/* Numbered Pagination */ | |
function numbered_page_nav($prelabel = '', $nxtlabel = '', $pages_to_show = 6, $always_show = false) { | |
global $wp_query, $request, $posts_per_page, $wpdb, $paged; | |
$custom_range = round($pages_to_show/2); | |
if (!is_single()) { | |
if(!is_category()) { | |
preg_match('#FROM\s(.*)\sORDER BY#siU', $request, $matches); | |
} | |
else { |
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 | |
function maybe_append_searchwp_pdf_excerpt( $excerpt ) { | |
global $post; | |
$pdf_excerpt_length = 15; // number of words in PDF excerpt | |
if ( is_search() && ! post_password_required() ) { |
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 | |
function my_searchwp_prevent_indexing() { | |
$post_ids = array( 15, 90 ); // EXCLUDE posts 15 and 90 from the index and searches | |
return $post_ids; | |
} | |
add_filter( 'searchwp_prevent_indexing', 'my_searchwp_prevent_indexing' ); |
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
<div class="search-box"> | |
<form role="search" method="get" class="search-form" action="<?php echo get_permalink( 147 ); ?>"> | |
<label> | |
<span class="screen-reader-text">Search for:</span> | |
<input type="search" class="search-field" placeholder="Search …" value="" name="swpquery" title="Search for:"> | |
</label> | |
<input type="submit" class="search-submit" value="Search"> | |
</form> | |
</div> |
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 | |
class MyFirstClass { | |
public function do_math( $x, $y ) { | |
return $x + $y; | |
} | |
} |
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 | |
function my_batcache_searchwp_delta_update( $post_id ) { | |
if ( class_exists( 'SearchWP' ) ) { | |
if ( $post->post_type != 'revision' && get_post_status( $post_id ) == 'publish' ) { | |
$searchwp = SearchWP::instance(); | |
$searchwp->purgePost( $post_id ); | |
$searchwp->triggerReindex(); | |
} | |
} |
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 | |
/** | |
* Inject a placeholder in the WP admin menu by bumping everything else down if necessary | |
* | |
* @param $position int The desired position to free up | |
*/ | |
function my_free_up_menu_slot( $position ) { | |
global $menu; |
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 | |
function searchwp_include_only_tax_term( $ids, $engine, $terms ) { | |
// if mycat is the GET variable in use, we want to limit to a specific custom taxonomy term | |
if( isset( $_GET['mycat'] ) ) { | |
$my_taxonomy = 'my_taxonomy'; // taxonomy name | |
$my_term = absint( $_GET['mycat'] ); // taxonomy term as defined by form submission | |
$args = array( $my_taxonomy => $my_term, 'fields' => 'ids' ); | |
$ids = get_posts( $args ); | |
} |
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 | |
function my_searchwp_extra_metadata( $extra_meta, $post_being_indexed ) { | |
// make sure there's a shortcode | |
if( has_shortcode( $post_being_indexed->post_content, 'gallery' ) ) { | |
$galleries = get_post_galleries_images( $post_being_indexed ); | |
if( !empty( $galleries ) ) { | |
$all_gallery_images = array(); | |
foreach( $galleries as $gallery ) { | |
foreach( $gallery as $image ) { |
OlderNewer