• Hello, im trying to add some shortcodes to my wordpress, but it give me an error on any of my scripts, here is one of them:

    function permalink_thingy($atts) {
    	extract(shortcode_atts(array(
    		'id' => 1,
    		'text' => ""  // default value if none supplied
        ), $atts));
    
        if ($text) {
            $url = get_permalink($id);
            return "<a href=".$url." rel='nofollow'>$text</a>";
        } else {
    	   return get_permalink($id);
    	}
    
    }
    add_shortcode('permalink', 'permalink_thingy');

    I put this on my functions.php i dont know whats the problem.
    The error i get is this one:

    Fatal error: Call to undefined function add_shortcode() in /home/xxxxx/public_html/wp-includes/functions.php on line 66

Viewing 3 replies - 1 through 3 (of 3 total)
  • i have the same problem, could you solve it?
    thx

    What folder have you put this in?

    Do you realize NOT to use wp-includes folder for these types of things?

    You should have a functions.php file in your theme. If not, create one and put the code there.

    I do that racer x…. what can i do to solve the problem?

    sry for my english

    regards

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘add_shortcode problem!’ is closed to new replies.