-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex-code-feature.php
81 lines (63 loc) · 1.87 KB
/
index-code-feature.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
<?php
/*
*
* Master Code For Feature Post
*
*/
?>
<div class="your-class">
<?php
$custom_query_args = array(
'post_type' => 'any',
'post__in' => array( 301 )
);
// Get current page and append to custom query parameters array
$custom_query_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$custom_query = new WP_Query( $custom_query_args ); ?>
<?php
// Pagination fix
global $wp_query;
$temp_query = $wp_query;
$wp_query = NULL;
$wp_query = $custom_query;
?>
<?php if ( $custom_query->have_posts() ) : ?>
<!-- the loop -->
<?php while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?>
<article id="mid-post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="post-thumbnail">
<?php the_post_thumbnail(); ?>
</div>
<div class="post-content">
<h2>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h2>
<p>
<?php the_excerpt(); ?>
</p>
<div class="category-cstm">
<?php san_category_customnolink(); echo do_shortcode('[rt_reading_time postfix="min read" postfix_singular="min read"]');?>
</div>
</div>
</article>
<?php endwhile; ?>
<!-- end of the loop -->
<!-- pagination here -->
<?php
// Custom query loop pagination
previous_posts_link( 'Older Posts' );
next_posts_link( 'Newer Posts', $custom_query->max_num_pages );
?>
<?php else: ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
<?php
// Reset postdata
wp_reset_postdata();
?>
<?php
// Reset main query object
$wp_query = NULL;
$wp_query = $temp_query;
?>
</div>