Best 2 Know

The Ultimate Blogging Resource

  • Advertising
  • WebHosting
  • Contact Us
  • Blogger
    • Blogger Templates
    • Blogger Tutorials
  • Browser
    • Firefox
    • Google Chrome
  • Google
  • Internet
    • Facebook
    • Twitter
  • Thesis
  • Windows
  • WordPress
    • WordPress Themes
    • WordPress Plugins
  • More
    • Linux
    • Review
    • Solutions
    • Announcements

How to create a Shortcode

WordPress shortcode are very useful function that helps lot of us. its similar to shortcuts , its been introduced since WordPress 2.5 They’re hooks which allow you to call a php function simply by typing something like [shortcode]. It is a great way to save time on repetitive tasks

To create a shortcode, you first have to create a php function and then you need to add it to your functions.php
We will be writing a basic function here :

function myfunction() {
    return 'I m learning now How to create a Shortcode in WordPress at <a href="http://wpden.net">WordPress Den</a>';
}

Once you are done with function, you need to use add_shortcode() function. Paste this code in your functions.php :

add_shortcode('wpden', 'myfunction');

as you can clearly see above wpden is my Shortcode for the function of myfunction

Now you can use the Shortcode were everyou want in your post or page (In HTML Editor):

[wpden]

The Above Shortcode will give the result :
I m learning now How to create a Shortcode in WordPress at WordPress Den

Subscribe via Email

Share this:

  • Twitter
  • Facebook
  • Pocket
  • Print
  • Email

Related

March 14, 2011 Ritesh Sanap WordPress Shortcode, Tricks, wordpress hacks, WordPress Tips, WordPress Tricks

Post navigation

Previous Previous post: Best 2 Know was Hacked
Next Next post: How to add our own logo to Dashboard

Currently Trending

  • Windows Vista CD key
  • How to download Specific parts of YouTube videos
  • HORIZONTAL AND VERTICAL SPACING
  • How to Increase Dropbox upload speed
  • Eleven Best free Photo/Pics Editors - Which To Choose ??
  • h4x0r ( Hacker ) - Blogger Template
  • How to download torrents without utorrent
  • Add Three New Widgets At The Bottom or Header Of Blogger/Blogspot Blog
  • Cannot Open Google or Gmail in Google Chrome
  • A NotePad Trick - What happened on 9/11/2001 !

Random Posts

How to Hide Desktop Icons in Mac

November 28, 2014 By Ritesh Sanap Leave a Comment

How to Disable Self Pingback or TrackBack

January 16, 2014 By Ritesh Sanap Leave a Comment

WordPress To Blogger For Free

May 10, 2010 By Ritesh Sanap 61 Comments

Who else wants to Calculate online Using Google Search !

July 19, 2008 By Ritesh Sanap Leave a Comment

How to Automatically Optimize Images in WordPress

August 26, 2011 By Ritesh Sanap 3 Comments

WordPress

HTTP2 Server Push for W3 Total Cache Minify plugin

August 17, 2016 By Ritesh Sanap 5 Comments

How to Disable Emojis in WordPress

January 6, 2016 By Ritesh Sanap Leave a Comment

JetPack Related posts and Sharing not working with NGINX

November 10, 2015 By Ritesh Sanap Leave a Comment

Simply Pure – WordPress Theme

November 2, 2014 By Ritesh Sanap 2 Comments

Advanced What should we Write about next? – WordPress Plugin

July 28, 2014 By Ritesh Sanap Leave a Comment

How to Disable Self Pingback or TrackBack

January 16, 2014 By Ritesh Sanap Leave a Comment

BlueStrap – WordPress Theme

January 1, 2014 By Ritesh Sanap 15 Comments

How to Create Multiple Excerpts in WordPress

December 24, 2013 By Ritesh Sanap Leave a Comment

How to Disable Auto Update in WordPress

November 21, 2013 By Ritesh Sanap Leave a Comment

How to Delete Feedbacks from JetPack Contact Form

November 19, 2013 By Ritesh Sanap 9 Comments

Recent Posts

  • HTTP2 Server Push for W3 Total Cache Minify plugin
  • How to show hidden files and folders in Mac OS X
  • How to Disable Emojis in WordPress
  • Canva – Online Photo Editor
  • JetPack Related posts and Sharing not working with NGINX

Archives

Recommends

  • DigitalOcean – Cloud Hosting
  • Dropbox – Cloud Storage
  • Elegant Themes – WordPress Themes
  • LastPass – Password Manager
  • Like us on Facebook
  • Follow on Twitter
  • +1 on Google
  • Subscribe via Email
  • RSS Feed

© 2021 Best 2 Know · All Rights Reserved · We ♥ DigitalOcean

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.