From 1373956529cd4c5f7a5bdfaefad407b24c8bb828 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 5 Nov 2018 12:47:47 +0100 Subject: Adds first version of an API to get the top navigation menu and the sidebar. --- api/api.php | 15 +++++++++++++++ api/menu.php | 6 ++++++ api/sidebar.php | 12 ++++++++++++ functions.php | 5 +++++ 4 files changed, 38 insertions(+) create mode 100644 api/api.php create mode 100644 api/menu.php create mode 100644 api/sidebar.php diff --git a/api/api.php b/api/api.php new file mode 100644 index 0000000..8332946 --- /dev/null +++ b/api/api.php @@ -0,0 +1,15 @@ + 'GET', + 'callback' => 'fk_get_menu', + ) ); + register_rest_route( 'fuselkoenig', '/sidebar', array( + 'methods' => 'GET', + 'callback' => 'fk_get_sidebar', + ) ); +} ); diff --git a/api/menu.php b/api/menu.php new file mode 100644 index 0000000..58ef116 --- /dev/null +++ b/api/menu.php @@ -0,0 +1,6 @@ + $content); + ob_end_clean(); + + return $content; +} + diff --git a/functions.php b/functions.php index 5e1fef8..7eebc3f 100644 --- a/functions.php +++ b/functions.php @@ -117,6 +117,8 @@ add_filter('posts_where', 'Delay_RSS_After_Publish'); /** * Deaktiviert REST-API und entfernt die Header aus dem HTML. + * + * It seems it doesn't work though. */ add_filter('rest_enabled', '_return_false'); add_filter('rest_jsonp_enabled', '_return_false'); @@ -250,3 +252,6 @@ if ( ! function_exists("get_my_clean_title")) { remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); remove_action( 'wp_print_styles', 'print_emoji_styles' ); */ + +require_once get_template_directory() . '/api/api.php'; + -- cgit v1.2.3