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

Smarter Learning for a Smarter Era: How AI Is Transforming Learning Management Systems (LMS) in 2025

  Smarter Learning for a Smarter Era: How AI IsTransforming Learning Management Systems(LMS) in 2025 From Static Systems to Intelligent…

Shafeeq Khan
October 3, 2025

AI Overviews and Google Search: What Businesses Need to Know in 2025

  AI Overviews and Google Search: What Businesses Need to Know in 2025 Entering the Age of AI Overviews The…

Shafeeq Khan
September 23, 2025

Ride Smarter: How AI Is Transforming Cab Apps in the USA for 2025

  Ride Smarter: How AI Is Transforming Cab Apps in the USA for 2025 The New Pulse of Urban Travel…

Shafeeq Khan
September 20, 2025
,

Leave a Reply

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