From cf48c3ba4aba8833d67fa13e25610a34d0a34aa5 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 10 Feb 2019 01:32:47 +0100 Subject: New api method to get wp_head() as JSON. --- api/api.php | 5 +++++ api/head.php | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 api/head.php diff --git a/api/api.php b/api/api.php index 8332946..35c4496 100644 --- a/api/api.php +++ b/api/api.php @@ -2,6 +2,7 @@ require_once get_template_directory() . '/api/menu.php'; require_once get_template_directory() . '/api/sidebar.php'; +require_once get_template_directory() . '/api/head.php'; add_action( 'rest_api_init', function () { register_rest_route( 'fuselkoenig', '/menu', array( @@ -12,4 +13,8 @@ add_action( 'rest_api_init', function () { 'methods' => 'GET', 'callback' => 'fk_get_sidebar', ) ); + register_rest_route( 'fuselkoenig', '/head', array( + 'methods' => 'GET', + 'callback' => 'fk_wp_head', + ) ); } ); diff --git a/api/head.php b/api/head.php new file mode 100644 index 0000000..1dc6cb4 --- /dev/null +++ b/api/head.php @@ -0,0 +1,12 @@ + $content); + ob_end_clean(); + + return $content; +} + -- cgit v1.2.3