homepage as a menu
This commit is contained in:
parent
8c7448f358
commit
09eedb3850
@ -57,7 +57,7 @@ function register_ildi_menus() {
|
|||||||
register_nav_menus(array(
|
register_nav_menus(array(
|
||||||
'header-menu' => __('Header Menu', 'ildi'),
|
'header-menu' => __('Header Menu', 'ildi'),
|
||||||
'utility-menu' => __('Utility Links', 'ildi'),
|
'utility-menu' => __('Utility Links', 'ildi'),
|
||||||
// 'footer-menu' => __('Footer Menu', 'ildi')
|
'homepage-list' => __('HomePage List', 'ildi')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,28 +1,45 @@
|
|||||||
<div class="grid xs-col-100 sm-col-50 md-col-33 grid-gutter-lg">
|
<div class="grid xs-col-100 sm-col-50 md-col-33 grid-gutter-lg">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sticky = get_option( 'sticky_posts' );
|
$homeList = wp_get_nav_menu_items('homepage-list');
|
||||||
$args = array(
|
|
||||||
'posts_per_page' => 12,
|
|
||||||
'post__in' => $sticky,
|
|
||||||
'ignore_sticky_posts' => 1
|
|
||||||
);
|
|
||||||
$query = new WP_Query( $args );
|
|
||||||
|
|
||||||
if ( isset($sticky[0]) && $query->have_posts() ) {
|
if($homeList){
|
||||||
while ( $query->have_posts() ) {
|
foreach($homeList as $item){
|
||||||
$query->the_post(); ?>
|
$post = get_post($item->object_id);
|
||||||
|
|
||||||
<section class="home-loop">
|
?><section class="home-loop">
|
||||||
<a href="<?php echo get_page_link(); ?>"><?php
|
<a href="<?php echo get_page_link($post); ?>">
|
||||||
the_title( '<h1>', '</h1>' );
|
<h1><?php echo($post->post_title); ?></h1>
|
||||||
the_post_thumbnail();
|
<?php echo(get_the_post_thumbnail($post)); ?>
|
||||||
?></a>
|
</a>
|
||||||
</section>
|
</section><?php
|
||||||
|
}
|
||||||
|
|
||||||
<?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 );
|
||||||
|
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
wp_reset_postdata();
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user