Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress shortcodes not working

Everytime i try to add a shortcode into my Wordpress site it ends up merely displaying the code i add to the actual page. I've been pasting the code into the "text" area of the content section but still doesnt work.

Even when I paste inside of the header.php file I recieve the same result. For example.

I recently copy pasted the following code in header.php (as instructed by the plugin i downloaded) <div class="headerslider"> <?php echo do_shortcode('[sp_responsiveslider limit="-1"]'); ?></div>

When I save a reload, I just get [sp_responsiveslider limit="-1"] appear in my website. This happens with all shortcodes i do.

Please help

like image 945
Mesbah Jamali Avatar asked Apr 19 '14 22:04

Mesbah Jamali


1 Answers

It seems like the shortcode sp_responsiveslider isn't actually defined. Are you sure the plugin is installed correctly? If the plugin is installed correctly you can test to see if shortcodes are working on your WordPress installation. Paste the following in your functions.php file (add <?php to the first line if it's not already in the file):

function test_shortcodes()
{
    return 'Shortcodes are working!';
}
add_shortcode('test_shortcodes', 'test_shortcodes');

This will create a new shortcode in WordPress. To test if shortcodes are working put the text [test_shortcodes] within a post and view the page with the post. When you load the page the shortcode tag should be replaced with "Shortcodes are working!". If this works, there is an issue with the plugin and it's shortcode.

If the test text is not displayed there might be a problem with your WordPress installation.

like image 181
vvanasten Avatar answered Oct 17 '22 08:10

vvanasten