From 69c1cc4b83f2fb5248aea2caba678f533ec61d72 Mon Sep 17 00:00:00 2001 From: Sam Schneider Date: Tue, 15 Nov 2016 07:48:04 -0600 Subject: [PATCH 1/4] Add post thumbnail support for v2. --- includes/wp-api-menus-v2.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/wp-api-menus-v2.php b/includes/wp-api-menus-v2.php index ae7c82e..847d328 100644 --- a/includes/wp-api-menus-v2.php +++ b/includes/wp-api-menus-v2.php @@ -280,13 +280,14 @@ public function get_menu_location( $request ) { $cache = array(); foreach ( $rev_items as $item ) : - + $post_id = url_to_postid( $item->url ); $formatted = array( 'ID' => abs( $item->ID ), 'order' => (int) $item->menu_order, 'parent' => abs( $item->menu_item_parent ), 'title' => $item->title, 'url' => $item->url, + 'thumbnail' => has_post_thumbnail( $post_id ) ? get_the_post_thumbnail_url( $post_id ) : '', 'attr' => $item->attr_title, 'target' => $item->target, 'classes' => implode( ' ', $item->classes ), From 790d793737b2b96d75568dbaa012ae6398004093 Mon Sep 17 00:00:00 2001 From: Sam Schneider Date: Tue, 15 Nov 2016 19:46:02 -0600 Subject: [PATCH 2/4] Trying a fix for tab issue. --- includes/wp-api-menus-v2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wp-api-menus-v2.php b/includes/wp-api-menus-v2.php index 847d328..d9833e6 100644 --- a/includes/wp-api-menus-v2.php +++ b/includes/wp-api-menus-v2.php @@ -287,7 +287,7 @@ public function get_menu_location( $request ) { 'parent' => abs( $item->menu_item_parent ), 'title' => $item->title, 'url' => $item->url, - 'thumbnail' => has_post_thumbnail( $post_id ) ? get_the_post_thumbnail_url( $post_id ) : '', + 'thumbnail' => has_post_thumbnail( $post_id ) ? get_the_post_thumbnail_url( $post_id ) : '', 'attr' => $item->attr_title, 'target' => $item->target, 'classes' => implode( ' ', $item->classes ), From 29c3222d28842e63e6ce3b6d22b4abdfd1c08fb0 Mon Sep 17 00:00:00 2001 From: Sam Schneider Date: Tue, 15 Nov 2016 19:47:12 -0600 Subject: [PATCH 3/4] Fixed whitespace. --- includes/wp-api-menus-v2.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/wp-api-menus-v2.php b/includes/wp-api-menus-v2.php index d9833e6..acace5c 100644 --- a/includes/wp-api-menus-v2.php +++ b/includes/wp-api-menus-v2.php @@ -280,7 +280,8 @@ public function get_menu_location( $request ) { $cache = array(); foreach ( $rev_items as $item ) : - $post_id = url_to_postid( $item->url ); + + $post_id = url_to_postid( $item->url ); $formatted = array( 'ID' => abs( $item->ID ), 'order' => (int) $item->menu_order, From 6e7f4560c146bb45a68281ca5a994f4b299cf8a7 Mon Sep 17 00:00:00 2001 From: Sam Schneider Date: Tue, 15 Nov 2016 19:51:14 -0600 Subject: [PATCH 4/4] One more white space adjustment. --- includes/wp-api-menus-v2.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/wp-api-menus-v2.php b/includes/wp-api-menus-v2.php index acace5c..312a574 100644 --- a/includes/wp-api-menus-v2.php +++ b/includes/wp-api-menus-v2.php @@ -281,14 +281,14 @@ public function get_menu_location( $request ) { foreach ( $rev_items as $item ) : - $post_id = url_to_postid( $item->url ); + $post_id = url_to_postid( $item->url ); $formatted = array( 'ID' => abs( $item->ID ), 'order' => (int) $item->menu_order, 'parent' => abs( $item->menu_item_parent ), 'title' => $item->title, 'url' => $item->url, - 'thumbnail' => has_post_thumbnail( $post_id ) ? get_the_post_thumbnail_url( $post_id ) : '', + 'thumbnail' => has_post_thumbnail( $post_id ) ? get_the_post_thumbnail_url( $post_id ) : '', 'attr' => $item->attr_title, 'target' => $item->target, 'classes' => implode( ' ', $item->classes ),