PHP shortcode input variable

I’m displaying a gallery on my wordpress site using the following code:

<?php echo do_shortcode('[satellite gallery=2 auto=off caption=off thumbs=on]'); ?>

Now I’ve added a custom post value/field called ‘guitLink’ where I can add the gallery number which I want to then use in the above shortcode, so something like this:

Read More
<?php echo do_shortcode('[satellite gallery=' .get_post_custom_values('guitLink'). 'auto=off caption=off thumbs=on]'); ?>

Any ideas how to achieve this?

Related posts

1 comment

  1. Use:

    <?php $guitLink = get_post_custom_values('guitLink');
    echo do_shortcode('[satellite gallery=' .$guitLink[0]. ' auto=off caption=off thumbs=on]'); ?>
    

    Instead of

    <?php echo do_shortcode('[satellite gallery=' .get_post_custom_values('guitLink'). ' auto=off caption=off thumbs=on]'); ?>
    

Comments are closed.