I realized that I will likely reference many twitter people in posts and I think it is common courtesy to link to their profile so that you can go check them out if you want. However, I also want to be lazy and not have to type out their full twitter url all the time. Thus I decided that a shortcode would be nice and efficient.
With the following code,
[code type=”php”]
‘ . $content . ‘‘;
}
add_shortcode(‘twitter’, ‘twitter_shortcode’);
?>
[/code]
I can wrap a username in [twitter] [/twitter] and have it output the full link, like this You forgot a username for the Twitter shortcode
Edit
I have since realized that this is perfectly capable of working with identi.ca as well. For wordpress users of Identi.ca, copy/paste the following code into your functions.php file. It will work the exact same way regarding wrapping the user ID
[code type=”php”]
‘ . $content . ‘‘;
}
add_shortcode(‘identica’, ‘identica_shortcode’);
?>
[/code]
Like so: [identica]tw2113[/identica]
This is a really awesome shortcode. I’m redesigning Arbenting right now and am definitely going to work this into my new theme. Thanks!
thank you for the kind words Angie. Glad the shortcode will prove useful despite being so basic. Now to come up with more that solve regular problems.