WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. realtech
    Member
    Posted 2 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?

    http://wordpress.org/extend/plugins/simple-lightbox/

  2. Archetyped
    Member
    Plugin Author

    Posted 2 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
    Member
    Posted 2 years ago #

    Works perfectly... thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic