-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblog.php
96 lines (75 loc) · 2.67 KB
/
blog.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
<?php
/**
* Template Name: Blog Template
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package Tar
*/
get_header(); ?>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' , 'tar'); ?>
<footer class="entry-footer">
<?php edit_post_link( esc_html__( 'Edit', 'tar' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-footer -->
</header><!-- .entry-header -->
<div class="blog-list-wrapper">
<?php
$args = array (
'post__in' => '',
'ignore_sticky_posts' => 'false',
'posts_per_page' => '10',
'paged' => $paged
);
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
// the query
$the_query = new WP_Query( $args ); ?>
<?php if ( $the_query->have_posts() ) : ?>
<!-- the loop -->
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<section class="home-wrapper">
<div class="home-post-photo">
<?php if ( has_post_thumbnail() ) {the_post_thumbnail();
} else { ?>
<img src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/no-image.jpg" alt="<?php the_title(); ?>" />
<?php } ?>
</div>
<div class="home-post-others">
<div class="home-post-title">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
</div>
<?php get_template_part( 'template-parts/postmeta'); ?>
<p><?php echo substr(get_the_excerpt(), 0,50); ?>...</p>
<div class="continue-reading"><a href="<?php the_permalink(); ?>"><?php _e('Continue' , 'tar'); ?></a> </div>
</div>
<div class="clearfix"></div>
<!-- </div> -->
</section>
<?php endwhile; ?>
<!-- end of the loop -->
<!-- pagination here -->
<div class="clearfix"></div>
<div class="blog-pagination">
<?php next_posts_link(__('« Older Entries', 'tar'), $the_query->max_num_pages) ?>
<?php previous_posts_link(__('Newer Entries »', 'tar')) ?>
</div>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.', 'tar' ); ?></p>
<?php endif; ?>
</div>
<div class="nblog-sidebar">
<?php
if ( ! dynamic_sidebar( 'sidebar' ) ) {
the_widget( 'WP_Widget_Recent_Posts' );
the_widget( 'WP_Widget_Meta' );
the_widget( 'WP_Widget_Archives' );
the_widget( 'WP_Widget_Categories' );
} ?>
</div>
<div class="clearfix"></div>
<section class="footer-widget">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer') ) : endif; ?>
<div class="clearfix"></div>
</section>
<?php get_footer(); ?>