Create plugin and admin panel menu with add_menu_page

First lesson, about which I want to talk will be basic. To start creating your own plugin, you just need to create a file in the folder wp-content/plugins/.
Let's name the file my-wp-plugin.php.
Let's add basic data to the plugin in the form of comments. These comments will be used by WordPress for future plugins..

I don't think it's worth describing each item., everything seems to be clear from the example. After creating a file from the plugin, you can activate it in the admin panel. But while the plugin does nothing.
The next step is programming the base plugin. And here we will paste the code, which will add an admin menu item.

Add the code of the created plugin:

Function add_action() calls a function, that fires before the site loads. Function add_menu_page() adds our menu. In general, everything is so simple. You can read more about the add_menu_page function in code at wordpress.org.

Be sure to read about how to make an icon for a new item., it helps to earn customer loyalty.

I have done everything described and it works great..


Купить хостинг WordPress
WordPress tutor
Online tutoring services. List of courses I teach
  • Basic web design course;
  • Site layout;
  • General course on CMS WordPress and continuation of the course on template development;
  • Website development in PHP.
Read more on the page WordPress tutor
*/

Create plugin and admin panel menu with add_menu_page

The first lesson, which I want to talk about, will be basic. To start creating your own plugin, simply create a file in a folder wp-content/plugins/.
Let's name the file my-wp-plugin.php.

Let's add basic data in the form of comments to the plugin. These WordPress comments will be used for future plugin work.

I think it is not necessary to describe each point, everything seems to be clear from the example. After creating a file from the plugin, you can activate it in the admin. But so far the plugin doesn't do anything.

The next step will be to program the basic plugin. And here we will insert the code, which will add an admin menu item.

Complete the code of the created plugin:

Function add_action() calls a function, which works before loading the site. Function add_menu_page() adds a menu. In general, it's that simple. Learn more about the feature add_menu_page can be read in the code on the website wordpress.org.

Be sure to read about it, how to make an icon for a new item, it helps to earn customer loyalty well.

I did everything described myself and everything works perfectly.


Купить хостинг WordPress
WordPress tutor
Online tutoring services. List of courses I teach
  • Basic web design course;
  • Site layout;
  • General course on CMS WordPress and continuation of the course on template development;
  • Website development in PHP.
Read more on the page WordPress tutor
*/

Nikolaenko Maxim

Director of web studies ProGrafika. I am developing, website design and promotion. Always glad to new blog readers and good clients.


You may also like...

1 Response

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Templates for WordPress
The best hosting in Ukraine
Stable hosting for Drupal