-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
51 lines (37 loc) · 1.3 KB
/
search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* Search results.
*
* @package Dkjensen\JesusFilmProject
* @link https://dkjensen.com
* @author David Jensen
* @copyright Copyright © 2021 David Jensen
* @license GPL-3.0
*/
namespace Dkjensen\JesusFilmProject;
\remove_all_actions( 'genesis_loop' );
\remove_filter( 'post_class', __NAMESPACE__ . '\Structure\archive_post_class' );
\add_action( 'genesis_before_loop', __NAMESPACE__ . '\do_search_title' );
/**
* Echo the title with the search term.
*
* @since 1.9.0
*/
function do_search_title() {
$title = sprintf( '<div class="archive-description"><h1 class="archive-title">%s %s</h1></div>', \apply_filters( 'genesis_search_title_text', \__( 'Search Results for:', 'genesis' ) ), \get_search_query() );
echo \apply_filters( 'genesis_search_title_output', $title ) . "\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
\add_action( 'genesis_loop', __NAMESPACE__ . '\do_search_results' );
function do_search_results() {
if ( \have_posts() ) {
\do_action( 'genesis_before_while' );
while ( \have_posts() ) {
\the_post();
\get_template_part( 'template-parts/content', 'search' );
}
\do_action( 'genesis_after_endwhile' );
} else {
\do_action( 'genesis_loop_else' );
}
}
\genesis();