Notice Shortcode Plugin
A WordPress plugin that adds a customizable frontend notice using a shortcode.
by Aditya Kumar Singh · github.com/adityas62/notice-shortcode-plugin
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/adityas62/notice-shortcode-plugin/archive/refs/heads/main.zipA simple WordPress plugin that adds a shortcode to display customizable notices on the frontend of a website.
This plugin is built to demonstrate WordPress fundamentals such as plugins, shortcodes, hooks, sanitization, and clean code structure.
Features
- Adds a frontend shortcode to display notices
- Supports custom messages via shortcode attributes
- Uses WordPress best practices
- Sanitizes output for security
- Lightweight and beginner-friendly
Usage
After activating the plugin, use the shortcode inside any post or page:
[notice]
Custom Message Example
You can pass a custom message using an attribute:
[notice message="Welcome! This notice is generated using a shortcode."]
How It Works
- The plugin registers a shortcode using
add_shortcode() - The shortcode callback function returns HTML output
- Default values are handled using
shortcode_atts() - Output is sanitized using
esc_html()for security - Basic styles are injected using the
wp_headaction hook
Security Practices
- Prevents direct access using
ABSPATHcheck - Escapes frontend output to avoid XSS attacks
- Follows WordPress coding standards
📁 Plugin Structure
noticeSC/ ├── noticeSC.php └── README.md
Author
Aditya Kumar Singh
Notes
This plugin is created for learning and demonstration purposes and is suitable for beginner to intermediate WordPress developers.
License
This project is open-source and free to use for educational purposes.