1

I have set up a content-slide.php template to replace the featured image with a smartslider 3 slider in Wordpress using the shortcode:

[smartslider3 slider=x]

where 'x' is the id number generated by the smartslider plugin

The template allows the id number to be added via a custom field named 'Slideshow ID' to enable the slide number to be added in edit mode.

I have tried adding the following code to the template:

<?php 
$slide_id = get_post_meta($post->ID, 'Slideshow ID', true); 
echo do_shortcode('[smartslider3 slider= ' . $slide_id . ']' ); 
?>

The slideshow does appear, however the ']' is being rendered on the page on one of the two slides I have added to the site. I'm very new to PHP and would really appreciate any help on where I am going wrong.

4

0 回答 0