PageRenderTime 22ms CodeModel.GetById 15ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/nx/index.php

https://bitbucket.org/Trulsh/personal-bootstrap-projects
PHP | 79 lines | 45 code | 34 blank | 0 comment | 7 complexity | 903ae69eed863f5d69e4213de42dccd3 MD5 | raw file
 1<?php get_header(); ?>
 2
 3<div class="container my-5">
 4
 5  <?php if(is_search()) { ?>
 6
 7    <h1><?php esc_html_e( 'Results for:', 'nx'); ?> <?php echo $s; ?></h1>
 8
 9  <?php } else if(is_category() || is_tag() ) { ?>
10
11    <h1><?php echo single_cat_title(); ?></h1>
12
13  <?php } else { ?>
14
15    <h1><?php bloginfo('description');?></h1>
16
17  <?php } ?>
18
19  <hr>
20</div>
21
22<main class="container">
23
24  <div class="row">
25    <div class="col-sm-8">
26
27      <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
28
29        <article <?php post_class(); ?>>
30
31            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
32            <p> <?php the_time('j M Y'); ?> - <?php the_category(', ');?></p>
33
34            <a href="<?php the_permalink(); ?>">
35              <?php the_post_thumbnail('nx_single', array( 'class' => 'img-fluid mb-4', 'alt' => get_the_title() ))?>
36            </a>
37
38            <?php the_excerpt(); ?>
39
40        </article>
41
42        <hr class="my-5">
43
44      <?php endwhile; ?>
45
46       <div class="pagination">
47
48        <?php
49        global $wp_query;
50
51        $big = 999999999; // need an unlikely integer
52
53        echo paginate_links( array(
54        	'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
55        	'format' => '?paged=%#%',
56        	'current' => max( 1, get_query_var('paged') ),
57        	'total' => $wp_query->max_num_pages
58        ) );
59        ?>
60
61      </div>
62
63
64
65      <?php else: ?>
66
67        <p><?php esc_html_e('Sorry, no post matched your criteria.', 'nx'); ?></p>
68
69      <?php endif; ?>
70
71    </div>
72
73    <?php get_sidebar(); ?>
74
75  </div>
76
77</main>
78
79<?php get_footer(); ?>