Plugin DevelopmentTutorialsWord CountWordPress

Learn WordPress Plugin Development Form Basic to Advanced – ( Word Count Plugin )

22views

The world of plugins will appear a shivery place to venture if you’ve ne’er been there before. My 1st thoughts were “no way, i’ve got no plan however and I’m comfortable with themes.” once a bit little bit of moaning, i made a decision to leap in and figure it out. A year and a half later I’m here, telling all of you ways to put in writing a plugin. Believe me, it’s not nearly as scarey as i believed it had been.

So, lets start our first plugin called “Word Count” , I am using PhpStrom editor to develop our plugin. Now, we have to create a folder named “Word Count” to ( wp-content -> plugin )  directory like screenshot.

Now we start our coding create a .php file named word-count.php or index.php whatever you want. After creating the word-count.php we have to write some default code given below

Create your own Header for plugin Click here Plugin Header Generator

 

/*
Plugin Name: Word Count
Plugin URI: https://nahincj.com
Description: Count Words from any WordPress Post
Version: 1.0
Author: nahin
Author URI: https://nahincj.com
License: GPLv2 or later
Text Domain: word-count
Domain Path: /languages/
*/

 

After completing this code you will see the plugin on you plugin tabs of wordpress dashboard like screenshot

Now we load the text domain using add_action(‘plugin_loaded’, ‘wordcound_load_textdomain’); and create a
function name called wordcount_load_textdomain(){} code has given below

function wordcound_load_textdomain(){
    load_plugin_textdomain('word-count',false,dirname(__FILE__). "/languages");
}
add_action('plugin_loaded', 'wordcound_load_textdomain');

Leave a Response