• Resolved vanak

    (@vanak)


    Hi,

    I have shortcode tag on a template page like so…

    <?php
    echo do_shortcode('[nggallery id=1 template="galleryview"]');
    ?>

    However, where it says ‘id=1’ I would like to insert a variable so the client can say which gallery id to use. But when I use ‘$gallery_id’ instead it doesn’t work so I was just wondering does anybody know the correct syntax to achieve this?

    Many thanks for any help/ advice.

Viewing 1 replies (of 1 total)
  • Thread Starter vanak

    (@vanak)

    <?php
    echo do_shortcode('[nggallery id='.$gallery_id.' template="galleryview"]');
    ?>

    This worked, tried it yesterday and it didn’t work, tried it again today and it did so I must of had a typo yesterday. Solved now anyway.

Viewing 1 replies (of 1 total)

The topic ‘Embedding a Variable in shortcode’ is closed to new replies.