0
0
Wordpressframework~5 mins

Why plugins extend functionality in Wordpress

Choose your learning style9 modes available
Introduction

Plugins add new features to a WordPress site without changing its core code. They help you customize your site easily.

You want to add a contact form without coding.
You need to improve your site's SEO quickly.
You want to add an online store to your blog.
You want to add social media sharing buttons.
You want to improve site security with extra tools.
Syntax
Wordpress
<?php
/*
Plugin Name: My Custom Plugin
Description: Adds new features.
Version: 1.0
Author: Your Name
*/

function my_custom_function() {
    // Your code here
}
add_action('init', 'my_custom_function');
Plugins are written in PHP and placed in the wp-content/plugins folder.
Use WordPress hooks like add_action or add_filter to extend functionality.
Examples
This plugin shows a greeting message at the bottom of every page.
Wordpress
<?php
/*
Plugin Name: Simple Greeting
*/
function greet_user() {
    echo 'Hello, visitor!';
}
add_action('wp_footer', 'greet_user');
This plugin changes the logo on the WordPress login page.
Wordpress
<?php
/*
Plugin Name: Change Login Logo
*/
function custom_login_logo() {
    echo '<style>h1 a { background-image: url("logo.png") !important; }</style>';
}
add_action('login_head', 'custom_login_logo');
Sample Program

This plugin adds a bold welcome message centered at the bottom of every page on your WordPress site.

Wordpress
<?php
/*
Plugin Name: Welcome Message
Description: Displays a welcome message in the site footer.
Version: 1.0
Author: Your Name
*/

function display_welcome_message() {
    echo '<p style="text-align:center; font-weight:bold;">Welcome to my WordPress site!</p>';
}
add_action('wp_footer', 'display_welcome_message');
OutputSuccess
Important Notes

Always keep plugins updated to avoid security risks.

Too many plugins can slow down your site, so use only what you need.

Test plugins on a staging site before using them on a live site.

Summary

Plugins let you add features without changing WordPress core.

They use hooks to insert or change behavior.

Use plugins to customize your site easily and safely.