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
  • WhatsApp
  • Email

Related

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

Leave a Reply Cancel reply

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

Post navigation

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

Currently Trending

  • How to download Specific parts of YouTube videos
  • h4x0r ( Hacker ) - Blogger Template
  • You might also like this Widget for blogger or Related post widget
  • How to add a bookmarking widget below Post Title
  • 100+ Best Online Games - Who Else Wants to Play ?
  • Bypassing Word Verification for links in Orkut
  • How to Upload Images by URL in Blogger
  • Shortcut keys to Complete URL
  • Random Post Widget for Blogger
  • Google Voice invites for students

Get Latest post in your Inbox

Random Posts

Google Voice invites for students

May 14, 2010 By Ritesh Sanap Leave a Comment

How to retrieve my Demonoid username

December 18, 2014 By Ritesh Sanap Leave a Comment

Change From .co.in to .com in orkut – Enjoy Better orkuting

July 16, 2008 By Ritesh Sanap Leave a Comment

How to Delete Feedbacks from JetPack Contact Form

November 19, 2013 By Ritesh Sanap 9 Comments

Creating custom couter strikes 1.6 sprays

January 16, 2008 By Ritesh Sanap Leave a Comment

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

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