How to Add your own shortcode in Wordpress

In your "functions.php" file in your child theme folder create a function and use the following code to initiate the short code

add_shortcode('credits', 'show_website_credits');

The first variable above is the shortcode itself ( in this case [credits]) and the second variable is the name of the function.

In total it will look like this

function show_website_credits() {
  return "Website developed by Brendan.";
}
add_shortcode('credits', 'show_website_credits');


Comments

Popular posts from this blog

How To: Get Cell C HSDPA USB dongle to work in Ubuntu

How to Display Custom Wordpress Header with Google Analytics Site Tage and Adwords Site Tag

Enqueue Stylesheet or Javascript on just one Wordpress Page or Post