Skip to content

Commit

Permalink
Support Search WP
Browse files Browse the repository at this point in the history
  • Loading branch information
Ipstenu committed Feb 4, 2025
1 parent 289b759 commit f85fe1c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions plugins/lwtv-plugin/php/_components/class-plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use LWTV\Plugins\Gravity_Forms;
use LWTV\Plugins\Jetpack;
use LWTV\Plugins\Related_Posts_By_Taxonomy;
use LWTV\Plugins\SearchWP;
use LWTV\Plugins\WP_Rocket;
use LWTV\Plugins\Yoast;

Expand All @@ -27,6 +28,7 @@ public function init(): void {
new Gravity_Forms();
new Jetpack();
new Related_Posts_By_Taxonomy();
new SearchWP();
new WP_Rocket();
new Yoast();

Expand Down
23 changes: 23 additions & 0 deletions plugins/lwtv-plugin/php/plugins/class-searchwp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/*
* SearchWP
*
* @package lwtv-plugin
*/
namespace LWTV\Plugins;

class SearchWP {
/**
* Constructor
*/
public function __construct() {
if ( ! class_exists( 'SearchWP' ) ) {
return;
}

// If we're on a dev site, we want to index the alternate content.
if ( defined( 'LWTV_DEV' ) && LWTV_DEV ) {
add_filter( 'searchwp\indexer\alternate', '__return_true' );
}
}
}
2 changes: 1 addition & 1 deletion template-parts/header/searchbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="form-group row">
<label class="col-sm-3 col-form-label" for="search">Search the Site</label>
<div class="col-sm-7 searchbox-input">
<input type="text" name="s" id="header-search" class="form-control" placeholder="<?php echo esc_attr_x( 'Enter keywords &hellip;', 'placeholder', 'lwtv-underscores' ); ?>" value="<?php the_search_query(); ?>" title="<?php echo esc_attr_x( 'Search for:', 'label', 'lwtv-underscores' ); ?>" />
<input type="text" name="s" id="header-search" class="form-control" placeholder="<?php echo esc_attr_x( 'Enter keywords &hellip;', 'placeholder', 'lwtv-underscores' ); ?>" value="<?php the_search_query(); ?>" title="<?php echo esc_attr_x( 'Search for:', 'label', 'lwtv-underscores' ); ?>" data-swplive="true" />
</div>
<?php
if ( ! class_exists( 'Jetpack_Search' ) ) {
Expand Down

0 comments on commit f85fe1c

Please sign in to comment.