WordPress Shortcode.

Code

Since Version 2.5 WordPress supports so called ‘Shortcodes’.
Example:

Shortcodes can also be used with attributes as the following example shows:
Example:

WordPress have some of the shortcodes by default (for example the audio one).
The following shortcodes are included with WordPress:

hortcodes are of both type singular and paired.

We can define custom shortcodes using add_shortcode
Example:

Calling Shortcode

In Php:
do_shortcode('[MyFirstShortcode]');
In Editor:
[MyFirstShortcode];

Defining Shortcode


add_shortcode('MyFirstShortcode','MyFirstShortcodeCallback');
function MyFirstShortcodeCallback() {
    echo 'hello';
}

Shortcodes with attributes as the following example shows:
Example:

Calling Shortcode

In Php:
do_shortcode('[MyFirstShortcode title="This Is Shortcode"]');
In Editor:
[MyFirstShortcode  title="This Is Shortcode" ];

Defining Shortcode

add_shortcode('MyFirstShortcode','MyFirstShortcodeCallback');
function MyFirstShortcodeCallback($attr) {
    echo $atts['title'];
}
//output This Is Shortcode

Shiv kumawat

Executive Director & CEO

"Shiv kumawat is the Executive Director and CEO of Eoxys It Solution LLP and the strategic mind behind the company"s growth. His expertise in operational efficiency and team leadership empowers his colleagues to excel and innovate.”

Latest Posts

AI Powered Event Planning Apps 2026 The Ultimate Interactive Guide

  AI Powered Event Planning Apps 2026 The Ultimate Interactive Guide Why Event Apps Need AI Now   Event planners…

Shafeeq Khan
January 23, 2026

The AI Tutoring Revolution 2026 Inside the $8.7B EdTech Unicorn That 10x’d Learning Outcomes

  The AI Tutoring Revolution 2026 Inside the $8.7B EdTech Unicorn That 10x’d Learning Outcomes Case Study:EduMatch AI From $0…

Shafeeq Khan
January 22, 2026

AI in Restaurant & Food Delivery Apps 2026 Smart Ordering, Dynamic Menus & Kitchen Automation

  AI in Restaurant & Food Delivery Apps 2026 Smart Ordering, Dynamic Menus & Kitchen Automation The Dawn of Intelligent…

Shafeeq Khan
January 21, 2026
,

Leave a Reply

Your email address will not be published. Required fields are marked *