FavoriteLoadingAdd to favorites

This post requires developer discretion. The file names are written as an example for this post. As long as you make sure your files are been linked up correctly, you can name your files whatever you like. There’s loads of comments to help you along the way.
You need 2 files for this process. Unless you want to set a custom Icon then you will need 3 files.
All of these files need to be inside their own folder in order to build up your plugin.

Plugin Folder :

Your ICON. (Your icon dimensions must be 16×16)

plugin-index.php is your starting file. This is the file where your plugin starts. And it will contain the following.

  Plugin Name: coverweb Custom Woocommerce Extra's

  // Main Menu Tabs
    // add_menu_page();
  //(Sub Menu Tabs) List of possible pages you can add from pre built wp stuff (using the below functions will add a sub menu into the matching page tab )
    // add_dashboard_page();
    // add_posts_page();
    // add_pages_page();
    // add_comments_page();
    // add_plugins_page();
    // add_users_page();
    // add_theme_page();  /*for the appearance tab*/
    // add_management_page();  /*for the tools tab*/
    // add_options_page();  /*for the settings tab*/

  function my_admin_menu() {
      //(This will aqppear in place of the browser tab name)
      	$page_title = 'Clear Stock'; 
      //(This will aqppear in place of the tab name)
      	$menu_title = 'Clear Stock'; 
      //(Capability is required to display plugin menu in admin panel)
      	$capability = 'manage_options';
      //(Menu Slug is the text that refers this plugin page. It displays as page name in URL We always CALL a plugin page by the menu slug)
        $menu_slug = 'clear-stock';
      //(This calls the function below which has been set up to include a page that is in the plugin folder.)
        $function = 'clear_stock_function';
      //(This will get the icon you upload into your plugin file, Leave blank like so '' if you don't have an ICON and you will get a default Cog Icon)
        $icon_url = plugins_url('recycle.png',__FILE__);
      //(The position is just an integer. The higher you go. The lower down the position is in the admin section of wordpress)
        $position = 56;
      add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position);
  add_action( 'admin_menu', 'my_admin_menu' );

  function clear_stock_function(){
    include ("main-page.php"); //this must be inside your plugins folder

main-page.php is where you start writing your plugin content that will show up in your admin section. (Just start with the code below to get started)

<!DOCTYPE html>
  <title>Custom Plugin</title>
    <h1>Your new plugin Is ready to start been developed.</h1>

Your ICON : Must be 16×16.
A word of advice… make sure it’s a light icon that doesn’t disappear in the dark default wordpress dark grey colour.

Pin It on Pinterest

Share This