I am creating new shortcodes for WordPress on my local version of a WordPress website.
In functions.php, I am adding for example:
function shortTest() {
return 'Test for shortcodes ';
}
add_shortcode('shortTestHTML', 'shortTest');
Adding the function only is OK, but when I add the add_shortcode() portion, I get a major issue.
It breaks something somehow and I get 500 errors, meaning I can’t even load my website locally anymore.
Any thoughts???
Thanks so much!
EDIT:
From PHP Error Log:
[21-Jun-2011 19:02:37] PHP Fatal error: Call to undefined function add_shortcode() in /Users/jonas/Sites/jll/wp-includes/functions.php on line 4505
1) Make sure that you have included
shortcodes.phpfile somewhere (for example, inwp-load.phpor whatever other more appropriate place may be).2) Make sure that this file does exist on your installation (which I think you have otherwise we would see a different error).
3) Where do you call this function from (I see it is called from
functions.php, but which place)? Possible problem here —functions.phpis loaded prior toshortcodes.php, and if you do use thatadd_shortcodefunction beforeshortcodes.phpis loaded you most likely will see this error. Double check your code in that place — maybe move the call toadd_shortcodeto another place.