Blog for web designers

How to make a custom shortcode in wordpress

Shortcode are the wordpress powered codes that helps to enable the special kinds of content used in dashboard pages. To create new shortcode function. Use the below function to copy in funciton.php

function featured_images($atts, $content = null) {
return '<div class="fetaured_images">' . $content .'</div>
'; } 
add_shortcode('featured', 'featured_images');

You can now use your featured images inside the featured_images shortcode. Now you can use it in your dashboard pages.

[featured]<img title="title" alt="alternate text" src="..your_path.." />[/featured]

Santosh Shah

My name is Santosh Shah and blogs at santosh-shah.com


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.