WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Flickr Gallery] Using Flickr-Gallery In Template (5 posts)

  1. Mythender
    Member
    Posted 5 years ago #

    I'd like to use this plugin to display a photostream on my custom homepage. Obviously, as it's neither a page nor a post, shortcode doesn't get replaced. I love this extension's functionality in other parts of my site and would really like a way to use it on my front page. Is there a way to call it from a template?

  2. DanCoulter
    Member
    Posted 5 years ago #

    You can use any shortcode directly in a template file like thus:

    <?php echo do_shortcode('[foo bar=1]') ?>

  3. Mythender
    Member
    Posted 5 years ago #

    thanks a ton ^_^

  4. zygut
    Member
    Posted 5 years ago #

    If I put: [flickr-gallery mode="tag" tags="Vassar" tag_mode="all"] into my templated page, the gallery gets added to the bottom.

    If I do <?php echo do_shortcode('[flickr-gallery mode="tag" tags="Vassar" tag_mode="all"]')?> then the text up to the gallery is printed, then the gallery, but then rest of the template/page content isn't displayed!

  5. zygut
    Member
    Posted 5 years ago #

    I should maybe clarify a little more... I've got a page template that does the following:

    <?php get_header(); ?>
    
            <div id="content">
                    <div>
                    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                    <h1 class="alt"><?php the_title(); ?></h1>
                    <?php the_content(); ?>
    
                    <?php endwhile; endif; ?>
                    </div>
    
                    <p class="top"><a href="/the-route/">Back to map</a></p>                        
    
            </div> <!--/content-->
    
    <?php get_footer(); ?>

    All the short codes that I include in the page content do not get included in the_content(), but instead are all slapped in at the end of that first </div>

Topic Closed

This topic has been closed to new replies.

About this Topic