How to develop plugin for WordPress?

0
86

In fact, it would take no more than 10 minutes to write a simple WordPress plugin. In this article, we’ll look at how to write a simple plugin to display the last three articles anywhere on the site using a shortcode.

 

First, in the project folder /wp-content/plugins/, create the name of the plugin folder, for example, ms-plugin. Inside this folder, create 2 files, the first ms_plugin.php is the code handler, the second ms.css is the css styles.

 

The contents of the ms_plugin.php file:

The contents of the ms.css file (here you can add any styles for the plugin):

As a result, if you paste the shortcode [ms_posts] anywhere, the latest news will be displayed on the site:

 

 

You can also connect js libraries to this plugin in order to make a news slider or carousel. As a result, in the future you will spend no more than 10 minutes to create a plugin for WP.

LEAVE A REPLY

Please enter your comment!
Please enter your name here