Simple Lightbox
[resolved] SLB won't work with do_shortcode in theme template (3 posts)

  1. realtech
    Posted 3 years ago #

    If I place [gallery link="file" columns="1" size="medium"] in the post edit area it works fine.

    If I place <?php echo do_shortcode('[gallery link="file" order="ASC" columns="1" orderby="menu_order" size="medium"]'); ?> in the single.php file in the theme directory it does not add the 'rel=' to the hyperlink os the lightbox does not work.

    I assume the plugin injects the rel= code to the_content() only. Do you have a workaround for this?


  2. Archetyped
    Plugin Author

    Posted 3 years ago #

    Instead of using do_shortcode() directly, you can do the following:

    echo apply_filters('the_content', '[gallery...]');

    This will activate SLB for the gallery links and automatically generate the gallery shortcode's output as well.

  3. realtech
    Posted 3 years ago #

    Works perfectly... thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Simple Lightbox
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic