home page sticky loop
This commit is contained in:
@ -1,18 +1,27 @@
|
||||
<div class="grid xs-col-100 sm-col-50 md-col-33 grid-gutter-lg">
|
||||
<?php
|
||||
if ( have_posts() ) {
|
||||
while ( have_posts() ) {?>
|
||||
|
||||
$sticky = get_option( 'sticky_posts' );
|
||||
$args = array(
|
||||
'posts_per_page' => 10,
|
||||
'post__in' => $sticky,
|
||||
'ignore_sticky_posts' => 1
|
||||
);
|
||||
$query = new WP_Query( $args );
|
||||
|
||||
if ( isset($sticky[0]) && $query->have_posts() ) {
|
||||
while ( $query->have_posts() ) {
|
||||
$query->the_post(); ?>
|
||||
<section class="home-loop">
|
||||
<a href="<?php echo get_page_link(); ?>"><?php
|
||||
the_post();
|
||||
the_title( '<h1>', '</h1>' );
|
||||
the_post_thumbnail();
|
||||
// the_excerpt();
|
||||
?></a>
|
||||
</section>
|
||||
<?php }
|
||||
|
||||
get_template_part('pagination');
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
?>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user