I am using the Nivo Slider plugin for WordPress, but want to hard code the slider into my page and have it dynamically pull in the correct slider as the page and Nivo slider will share the same slug.
If my slider was called Flip Clock Print this is what works...
<?php echo do_shortcode('[nivoslider slug="flip-clock-print"]'); ?>
If I want the slug of the page, this is what works...
<?php echo $post->post_name; ?>
How do I combine the two together, because I guess this isn't right?
<?php echo do_shortcode('[nivoslider slug="$post->post_name;"]'); ?>
It's simply a matter of using the correct quote style.
You can do:
$var = 'Lorem ipsum ' . $other_var . 'lorem ipsum lorem';
$shortcode = '[nivoslider slug="' . $post->post_name .'"]';
echo do_shortcode( $shortcode );
Or
$var = "Lorem ipsum $other_var lorem ipsum lorem";
echo do_shortcode("[nivoslider slug='$post->post_title']");
Check: