forked from caslay/tiny_theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
404.php
57 lines (57 loc) · 2.04 KB
/
404.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
<?php
//Template Name: 404
get_header()
?>
<div class="container">
<header class="header-404">
<h1>404</h1>
<p><?php echo __( 'Sorry page was not found, try to search again or take a look at our posts.', 'tiny_theme') ?></p>
</header>
<section class="search-block">
<form role="search" method="get" id="search-form" action="<?php bloginfo('url') ?>">
<div>
<label><?php echo __( 'Search for:', 'tiny_theme') ?></label>
<input type="text" value="" name="s" placeholder="Search Keywords">
<input type="submit" value="Search" class="submit">
</div>
</form>
</section>
<div class="posts">
<?php $paged = get_query_var('paged'); ?>
<?php $p404 = new WP_Query(array('post_type'=> 'post', 'posts_per_page' =>6,'paged' => $paged)); ?>
<?php if($p404->have_posts()) : while($p404->have_posts()) : $p404->the_post(); ?>
<?php if ( is_sticky() ): ?>
<article id='<?php the_ID(); ?>' <?php post_class('sticky'); ?> >
<?php else: ?>
<article id='<?php the_ID(); ?>' <?php post_class(); ?> >
<?php endif; ?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title() ?></a></h2>
<p><?php the_excerpt() ?></p>
</article>
<?php endwhile; ?>
</div>
<div class="pagination">
<?php
global $p404;
$total = $p404->max_num_pages;
// only bother with the rest if we have more than 1 page!
if ( $total > 1 ) {
// get the current page
if ( !$current_page = get_query_var('paged') )
$current_page = 1;
// structure of "format" depends on whether we're using pretty permalinks
$format = get_option('permalink_structure')?'page/%#%/':'&page=%#%';
echo paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => $format,
'current' => $current_page,
'total' => $total,
'mid_size' => 4,
'type' => 'plain'
));
}
?>
</div>
<?php endif; ?>
</div>
<?php get_footer()?>