-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_postdata.php
More file actions
69 lines (62 loc) · 2.17 KB
/
setup_postdata.php
File metadata and controls
69 lines (62 loc) · 2.17 KB
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
<?php
$paged = get_query_var( "paged" ) ? get_query_var( "paged" ) : 1;
$posts_per_page = 2;
$post_ids = array( 58, 68, 43, 56, 81,70,38 );
$_p = get_posts( array(
'posts_per_page' => $posts_per_page,
'post__in' => $post_ids,
'orderby' => 'post__in',
'paged' => $paged
) );
foreach ( $_p as $post ) {
setup_postdata( $post );
?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></h2></a>
<?php
}
wp_reset_postdata();
?>
<div class="container post-pagination">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-8">
<?php
echo paginate_links( array(
'total' => ceil( count( $post_ids ) / $posts_per_page )
) );
?>
</div>
</div>
</div>
<?php // Author er posts dekhano
$paged = get_query_var( "paged" ) ? get_query_var( "paged" ) : 1;
$posts_per_page = 2;
$total = 9;
$post_ids = array( 58, 68, 43, 56, 81, 70, 38 );
$_p = get_posts( array(
'posts_per_page' => $posts_per_page,
'author__in' => array( 1 ),
'numberposts'=>$total,
'orderby' => 'post__in',
'paged' => $paged
) );
foreach ( $_p as $post ) {
setup_postdata( $post );
?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></h2></a>
<?php
}
wp_reset_postdata();
?>
<div class="container post-pagination">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-8">
<?php
echo paginate_links( array(
'total' => ceil( $total / $posts_per_page )
) );
?>
</div>
</div>
</div>