/
search.php
61 lines (37 loc) · 1.75 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
52
53
54
55
56
57
58
59
60
61
<?php
// Modify the search page markup
beans_add_smart_action( 'beans_before_load_document', 'fast_monkey_search_setup_document' );
function fast_monkey_search_setup_document() {
// Post
beans_add_attribute( 'beans_search_title', 'class', 'uk-margin-bottom-remove' );
beans_add_attribute( 'beans_content', 'class', 'uk-article' );
beans_remove_attribute( 'beans_post', 'class', 'uk-article' );
beans_modify_markup( 'beans_post_title', 'h2' );
beans_add_attribute( 'beans_post_title', 'class', 'uk-h2' );
beans_add_attribute( 'beans_post', 'class', 'uk-grid-margin' );
// Post image
beans_remove_action( 'beans_post_image' );
// Post meta
beans_remove_action( 'beans_post_meta' );
beans_remove_action( 'beans_post_meta_tags' );
beans_remove_action( 'beans_post_meta_categories' );
// Remove article search
beans_remove_output( 'beans_no_post_search_form' );
}
// Add the search form
beans_add_smart_action( 'beans_search_title_after_markup', 'fast_monkey_search_field' );
function fast_monkey_search_field( $content ) {
echo beans_open_markup( 'fast_monkey_search_content', 'div', array( 'class' => 'uk-grid-margin' ) );
get_search_form();
echo beans_close_markup( 'fast_monkey_search_content', 'div' );
}
// Clean up the search results item markup
beans_add_smart_action( 'the_content', 'fast_monkey_search_content' );
function fast_monkey_search_content( $content ) {
$output = beans_open_markup( 'fast_monkey_search_content', 'p' );
$output .= beans_output( 'fast_monkey_search_post_content', substr( strip_tags( $content ), 0, 150 ) . ' ...' );
$output .= beans_close_markup( 'fast_monkey_search_content', 'p' );
return $output;
}
// Load beans document.
beans_load_document();