From e6a97a7cae95dd68050c9c808d949f677490677d Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Tue, 21 Aug 2018 17:16:19 -0400 Subject: [PATCH] Fix frontpage map page collection code --- parts/map-section.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/parts/map-section.php b/parts/map-section.php index ddf9f76..b51c5c1 100644 --- a/parts/map-section.php +++ b/parts/map-section.php @@ -4,6 +4,10 @@
$page, + 'ID' => $page, 'post_type' => 'page', 'post_status' => 'publish', 'numberposts' => 1 ); - $location_page = get_posts($args); - console.log($location_page); - // echo '
', print_r($location_page), '
'; + + $location_page = get_post($page); if( !empty($location_page) ){ - $content = get_excerpt_by_id($location_page[0]->ID, 20); + $content = get_excerpt_by_id($location_page->ID, 20); // $content = get_the_excerpt($location_page[0]->ID); - $location_image_id = get_post_thumbnail_id($location_page[0]->ID); + $location_image_id = get_post_thumbnail_id($location_page->ID); $location_image = wp_get_attachment_image_src( $location_image_id, 'glm-map-image', true); - $location_url = get_permalink($location_page[0]->ID); + $location_url = get_permalink($location_page->ID); if($location_image_id){ $location_image = wp_get_attachment_image_src( $location_image_id, 'glm-map-image', true); @@ -48,12 +49,11 @@ } else { $location_image = null; } - //console.log($locations); - $locations[$location_page[0]->post_name] = array( - 'title' => $location_page[0]->post_title, - 'id' => $location_page[0]->ID, + $locations[$location_page->post_name] = array( + 'title' => $location_page->post_title, + 'id' => $location_page->ID, 'content' => $content, - 'slug' => $location_page[0]->post_name, + 'slug' => $location_page->post_name, 'image' => $location_image, 'url' => $location_url ); -- 2.17.1