/
search.php
92 lines (57 loc) · 2.37 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
// Setup frontpage view
add_action( 'beans_before_load_document', 'tbr_search_setup' );
function tbr_search_setup() {
beans_remove_markup( 'beans_grid' );
beans_remove_markup( 'beans_main_grid' );
beans_remove_markup( 'beans_post_header' );
beans_remove_markup( 'beans_post_content' );
beans_remove_markup( 'beans_post_body' );
beans_remove_action( 'beans_post_navigation' );
beans_remove_action( 'beans_post_image' );
beans_modify_action_hook( 'beans_posts_pagination', 'beans_primary_after_markup' );
beans_replace_attribute( 'beans_primary', 'class', 'tm-primary uk-width-medium-4-4', 'tm-search uk-list uk-list-striped' );
beans_modify_markup( 'beans_primary', 'ol' );
beans_modify_markup( 'beans_post', 'li' );
beans_remove_attribute( 'beans_post', 'id' );
beans_remove_attribute( 'beans_post', 'class' );
beans_remove_attribute( 'beans_post_title', 'class' );
beans_add_attribute( 'beans_search_form_input', 'class', 'uk-form-large' );
beans_modify_action_hook( 'beans_post_search_title', 'beans_primary_before_markup' );
beans_remove_attribute( 'beans_search_title', 'class', 'uk-article-title' );
}
// Include the needed uikit components
add_action( 'beans_uikit_enqueue_scripts', 'tbr_enque_uikit_search' );
function tbr_enque_uikit_search() {
beans_uikit_enqueue_components( array( 'list', 'badge', 'text', 'pagination' ) );
}
// Remove the categories prefix
add_filter( 'beans_search_title_text_output', 'tbr_search_title' );
function tbr_search_title() {
return 'Results for: ';
}
// Add the search form
add_action( "beans_primary_before_markup", "tbr_add_search_form" );
function tbr_add_search_form() { ?>
<div class="tm-search-form tm-box tm-box4">
<?php echo get_search_form(); ?>
</div>
<?php }
// Set the excerpt and readon link
add_filter( 'beans_post_append_markup', 'tbr_add_meta' );
function tbr_add_meta() {
global $post; ?>
<div class="tm-search-meta uk-clearfix uk-margin-small-top uk-margin-small-bottom">
<span><?php echo $post->post_type; ?></span> <em><?php echo the_permalink(); ?></em>
</div>
<?php }
// Set the excerpt and readon link
add_filter( 'the_content', 'tbr_modify_post_content' );
function tbr_modify_post_content( $content ) {
if (function_exists('relevanssi_the_excerpt')) {
$content = relevanssi_the_excerpt();
}
return $content;
}
// Load Beans
beans_load_document();