Site icon FahmidasClassroom

Simple WordPress plugin Development Tutorial-2

Plugin2

This tutorial will show the steps to create a plugin for designing a stylist table in the post or page.

Steps:

1. Create a new folder for your new plugin. Here, stylishtable folder is created.

2. Create two files named style.css and stylishtable.php inside that folder.

3. Add the following text as comment in stylishtable.php file.

<?php
/*
Plugin Name: Stylish Table
Plugin URI: https://fahmidasclassroom.com/
Description: Plugin Version: 1.0
Author: Fahmida
License: GPLv2 or later
*/

4. Add the following css code in style.css.

table
{ background-color:#C1E0EF;
	border-width: 1px;
	border-color:blue;
}

th{
	background-color:#7385B4;
	color: #121CD5;
}
td{
	color:#000000;
}

5. Add the following function to attach stylishtable.php file with the plugin.

function stylish_table() {
wp_register_style('stylish_table_style', plugins_url('style.css', __FILE__), false, "1.0");
wp_enqueue_style('stylish_table_style');
}
add_action('wp_enqueue_scripts', 'stylish_table');

6. Make the zip of the plugin folder.

7. Go to dashboard and upload and activate the plugin.

8. Create a post with table content.

9. Check the view of the latest post.

For another plugin tutorial click here.

Exit mobile version