I have been digging deep into wordpress plugin development (at least trying to) so that I can develop some plugins for my website that would enhance its user experience and reduce the maintenance efforts. One of the planned plugins is one that handles some shortcodes for me. Wordpress has provided a rich API for shortcode development and it is quite fun to use. But I am stuck with one issue that I need to resolve. The plan is to create a shortcode which uses a variable as the word. For instance the following code will register a shortcode [home] that will be converted to a link to the home page.
add_shortcode('home', 'show_home_link');function show_home_link () {return '<a href="http://http://www.mysite.com/;;}
But what i need is that the word "home" be a variable $var. The plan is to check the value of $var agains the post_title entries of the wp_posts table of the wordpress database. And then according to the match found, display appropriate link to that specific page. This would make me able to just say [about] to post a link to about page. or [my first blog post] to post a link to the post with title "my first blog post". I know how to develop the function to check agains database entries and produce corresponding link but what I don't know is how to make the shortcode use a variable entry.