From 09eedb385048604ff7965fa883ec2c7b7f1e08e5 Mon Sep 17 00:00:00 2001 From: Mark Moser Date: Sun, 11 Nov 2018 23:27:09 -0600 Subject: [PATCH] homepage as a menu --- functions.php | 2 +- home-loop.php | 55 +++++++++++++++++++++++++++++++++------------------ 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/functions.php b/functions.php index 950717e..22f8b69 100644 --- a/functions.php +++ b/functions.php @@ -57,7 +57,7 @@ function register_ildi_menus() { register_nav_menus(array( 'header-menu' => __('Header Menu', 'ildi'), 'utility-menu' => __('Utility Links', 'ildi'), - // 'footer-menu' => __('Footer Menu', 'ildi') + 'homepage-list' => __('HomePage List', 'ildi') )); } diff --git a/home-loop.php b/home-loop.php index b13f7f3..3f79f3a 100644 --- a/home-loop.php +++ b/home-loop.php @@ -1,28 +1,45 @@
12, - 'post__in' => $sticky, - 'ignore_sticky_posts' => 1 - ); - $query = new WP_Query( $args ); + $homeList = wp_get_nav_menu_items('homepage-list'); - if ( isset($sticky[0]) && $query->have_posts() ) { - while ( $query->have_posts() ) { - $query->the_post(); ?> + if($homeList){ + foreach($homeList as $item){ + $post = get_post($item->object_id); -
- ', '' ); - the_post_thumbnail(); - ?> -
+ ?>
+ +

post_title); ?>

+ +
+
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(); ?> + +
+ ', '' ); + the_post_thumbnail(); + ?> +
+ +