ildi-wp/home-loop.php

46 lines
1.0 KiB
PHP
Raw Normal View History

2018-07-24 08:20:35 -05:00
<div class="grid xs-col-100 sm-col-50 md-col-33 grid-gutter-lg">
<?php
2018-07-26 21:36:17 -05:00
2018-11-11 23:27:09 -06:00
$homeList = wp_get_nav_menu_items('homepage-list');
if($homeList){
foreach($homeList as $item){
$post = get_post($item->object_id);
?><section class="home-loop">
<a href="<?php echo get_page_link($post); ?>">
<h1><?php echo($post->post_title); ?></h1>
<?php echo(get_the_post_thumbnail($post)); ?>
</a>
</section><?php
}
} else {
$sticky = get_option( 'sticky_posts' );
$args = array(
'posts_per_page' => 12,
'post__in' => $sticky,
'ignore_sticky_posts' => 1
);
$query = new WP_Query( $args );
2018-07-26 21:36:17 -05:00
2018-11-11 23:27:09 -06:00
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_title( '<h1>', '</h1>' );
the_post_thumbnail();
?></a>
</section>
<?php }
}
wp_reset_postdata();
}
2018-07-24 08:20:35 -05:00
?>
</div>