I’m creating a shortcode for my own WordPress theme. I created this:
function link($atts, $content = null) {
extract(shortcode_atts(array(
"to" => 'http://net.tutsplus.com'
), $atts));
return '<a href="'.$to.'">'.$content.'</a>';
}
add_shortcode("link", "link");
But when I add this to my functions.php between opening and closing PHP-tags, it gives me a white page when I enter whatever WordPress page. So wp-admin and normal pages are all white.
I added it on top of functions.php and at the bottom. Neither worked. Can somebody explain why I get this?
Please use this code…
link is default keyword so you can not use link.
i hope you will get.
Accrording to your codes in comments:
You don’t need to use echo while you returning the value, it should be like this: