Creating A Basic WordPress Plugin: AwsmPwsm!

Going to keep this the shortest possible tutorial. Here’s how you can create a WordPress plugin (which just creates a shortcode that returns some text).

  1. Go to your site’s root directory and navigate to wp-content > plugins folder.
  2. Create a new folder in there called awsmpwsm.
  3. In this new folder, create just one single file with the same name: awsmpwsm.php.

Next, add this piece of code to it:


<?php
/* 
Plugin Name: Awsm Pwsm
Author: Omkar
Description: Something awsm!
Version: 0.1
*/

function an_awsm_example_func() {
	$information = 'basic plugin test';
	return $information;
}

add_shortcode('awsm-shrtcode', 'an_awsm_example_func');

?>

Save the file and the plugin is ready!

Activating The Plugin

To activate this, go to wp-admin dashboard > plugins page and activate it.

Screen Shot 2018-07-03 at 2.51.44 AM

Testing the Shortcode

  1. Create a new page and add the [awsm-shrtcode] text to it.
  2. Save the page and preview it in a new window!

Screen Shot 2018-07-03 at 2.54.17 AM.png

There you have it! 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s