forked from ProjectCleverWeb/Semantic-UI-WordPress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
155 lines (134 loc) · 5.09 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php get_header(); ?>
<div class="ui stackable grid" id="page-grid" role="main">
<div class="eleven wide column" id="main-content">
<article>
<div class="ui primary search segment" >
<section class="search content">
<h4><?php _e( 'Search Results', 'semantic_ui' ); ?></h4>
</section>
<div class="ui bottom attached label">"<?php echo esc_attr(get_search_query()); ?>"</div>
</div>
</article> <!-- /article -->
<?php
$article_count = 0;
if (have_posts()) : while (have_posts()) : the_post();
$is_sticky = is_sticky($post->ID);
$article_count++;
?>
<article id="post id <?php the_ID(); ?>" <?php post_class(); ?> role="article">
<div <?php
if($is_sticky) {
echo "class=\"ui top attached segment\"";
} else {
echo "class=\"ui top attached primary segment\"";
}
?> >
<header class="article header">
<?php
$post_title = trim(get_the_title());
$post_has_title = (!empty($post_title));
if ($post_has_title) {
?>
<h3 class="ui dividing header">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a>
</h3>
<?php
} else {
?>
<?php
}
?>
</header><!-- /.article.header -->
<section class="article content">
<?php
$post_img = $_sui->post->featured_img();
if ($post_img) {
$fstr = '<a href="%2$s"><img class="article featured image" src="%1$s" title="%3$s" ></a>';
echo sprintf($fstr,$post_img['url'], get_permalink(), the_title_attribute(array('echo' => FALSE)));
unset($fstr);
}
?>
<p><?php echo $_sui->post->the_content(); ?></p>
</section><!-- ./article.content -->
</div>
<footer class="ui bottom attached stacked secondary segment article footer">
<?php
if (!$is_sticky && has_tag()) {
?>
<p class="article tags">
Tags:
<?php
$fmt = '<a href="%2$s" id="tag-%3$s" title="%4$s"><span class="mini ui button">%1$s</span></a>';
echo $_sui->post->tags(0,0,' ',0,$fmt);
?>
</p>
<?php } ?>
<p class="byline vcard">
<img class="ui avatar image post avatar" src="http://placehold.it/100&text=Avatar">
<?php
if ($is_sticky) {
$fstr = 'Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by <span class="author">%3$s</span>';
} else {
$fstr = 'Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by <span class="author">%3$s</span> and filed under %4$s.';
}
printf(
__($fstr, 'semantic_ui'),
get_the_time('Y-m-j'),
get_the_time(get_option('date_format')),
sui_get_the_author_posts_link(),
get_the_category_list(', ')
);
?>
</p>
</footer> <!-- /.article.footer -->
<?php // comments_template(); // uncomment if you want to use them ?>
</article> <!-- /article -->
<?php endwhile;
sui_page_navi();
else : // for IF(have_posts()) ?>
<article>
<div class="ui top attached primary segment">
<header class="article header">
<h2 class="ui dividing header">
No content Found
</h2>
</header><!-- /.article.header -->
<section class="article content">
<h4>
The content you were looking for could not be found
</h4>
<div class="ui two column middle aligned relaxed grid basic segment">
<div class="center aligned not found column">
<p class="ui basic segment">
You can try searching again:
</p>
<?php echo sui_search(); ?>
</div>
<div class="ui vertical divider">
OR
</div>
<div class="center aligned not found column">
<p class="ui basic segment">
You can go back to the homepage:
</p>
<a class="small medium blue ui button" href="<?php echo home_url('/'); ?>">Go To Homepage</a>
</div>
</div>
</section><!-- ./article.content -->
</div>
<footer class="ui bottom attached stacked secondary segment article footer">
<p>
<!-- [comeback] add support email option -->
If you would like to report an error, you can email us at <a href="mailto:[email protected]">[email protected]</a>
</p>
</footer> <!-- /.article.footer -->
</article> <!-- /article -->
<?php endif; // for IF(have_posts()) ?>
</div><!-- /#main-content -->
<div class="five wide column" id="sidebar-content">
<?php get_sidebar(); ?>
</div><!-- /#sidebar-content -->
</div><!-- /#page-grid -->
<?php get_footer(); ?>