Skip to content

Instantly share code, notes, and snippets.

@jonathanbossenger
Created September 14, 2023 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanbossenger/41391ce7329a9290215ca7528f35b6b2 to your computer and use it in GitHub Desktop.
Save jonathanbossenger/41391ce7329a9290215ca7528f35b6b2 to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: WP Learn HTTP API
* Description: Learning about the WP HTTP API
* Version: 0.0.1
*/
/**
* Create an admin page to show the API data
*/
add_action( 'admin_menu', 'wp_learn_http_submenu', 11 );
function wp_learn_http_submenu() {
add_menu_page(
esc_html__( 'WP Learn HTTP', 'wp_learn' ),
esc_html__( 'WP Learn HTTP', 'wp_learn' ),
'manage_options',
'wp_learn_admin',
'wp_learn_render_http_admin_page',
'dashicons-admin-tools'
);
}
/**
* Render the admin page
*/
function wp_learn_render_http_admin_page(){
?>
<div class="wrap" id="wp_learn_admin">
<h1>Products</h1>
</div>
<?php
do_action('wp_learn_load_products_hook');
}
/**
* Load the data from the API
*/
add_action( 'wp_learn_load_products_hook', 'wp_learn_products_data' );
function wp_learn_products_data(){
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment