-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
91 lines (84 loc) · 3.2 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
<?php
/**
* The main template file of the CVJM Nuernberg layout template.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* For example, it puts together the home page when no home.php file exists.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage CVJM_Nuernberg
* @since CVJM_Nuernberg 1.0
*/
global $wp_query;
global $wp;
$is_evtermine = false;
get_header(); ?>
<?php $circle_name = 'circles_main'; require(locate_template('circles.php')); ?>
<div class="main_container">
<?php
if (array_key_exists('post_type', $wp_query->query) && strcmp($wp_query->query['post_type'], 'page') == 0) {
// It is page search
echo '<span class="search_headline search_headline_active">Seiten</span>';
} else {
echo '<span class="search_headline"><a href="';
echo add_query_arg(array('s' => $wp_query->query['s'], 'post_type' => 'page', 'orderby' => 'title', 'order' => 'ASC'), '', home_url( $wp->request ));
echo '">Seiten</a></span>';
}
if ((array_key_exists('post_type', $wp_query->query) && strcmp($wp_query->query['post_type'], 'post') == 0) &&
(array_key_exists('category_name', $wp_query->query) || stripos($wp_query->query['category_name'], 'news') !== false)) {
echo '<span class="search_headline search_headline_active">News</span>';
} else {
echo '<span class="search_headline"><a href="';
echo add_query_arg(array('s' => $wp_query->query['s'], 'post_type' => 'post', 'category_name' => 'news', 'orderby' => 'title', 'order' => 'ASC'), '', home_url( $wp->request ));
echo '">News</a></span>';
}
if (array_key_exists('termine', $_GET))
{
echo '<span class="search_headline search_headline_active">Termine</span>'. "\n";
$is_evtermine = true;
} else {
echo '<span class="search_headline"><a href="';
echo add_query_arg(array('s' => $wp_query->query['s'], 'termine' => 'yes'), '', home_url( $wp->request ));
echo '">Termine</a></span>' . "\n";
}
if ($is_evtermine === false) {
if (have_posts()) {
while (have_posts()) {
the_post();
echo '<p class="search_result">';
echo '<a href="';
echo the_permalink();
echo '" class="search_result_link">';
echo the_title();
echo '</a><br />';
echo the_excerpt();
echo '</p>' . "\n";
}
echo '<p align="right">';
$prev = get_previous_posts_link('« Vorherige Treffer ');
$next = get_next_posts_link(' Weitere Treffer »');
echo $prev;
if (strlen($prev) > 0 &&
strlen($next) > 0) {
echo ' | ';
}
echo $next;
echo '</p>' . "\n";
} else {
echo '<p class="search_result">Keine Treffer</p>';
}
} else {
echo '<div style="height: 0.5em"></div>';
$event_vid = '1495,1496,1497,1498,1499,1500';
$event_count = 20; $event_add_query = 'q=' . $wp_query->query['s'];
$event_show_filter = array('highlight' => 'no', 'noheadline' => 'yes');
require(locate_template('event-box.php'));
}
?>
</div>
<?php require(locate_template('sidebar.php')); ?>
<?php get_footer(); ?>