WordPress.org

Ready to get started?Download WordPress

Forums

Generating Galleries within a template via shortcode (2 posts)

  1. empulse
    Member
    Posted 2 years ago #

    I'm not really sure how to go about this, but I'm hoping someone here will be able to give me a hand...

    Here is my code for the template in question:

    <?php get_header('Energy'); ?>
    
    <div class="two-thirds first">
    <?php echo do_shortcode('[scrollGallery id=1]'); ?>
    </div>
    
    <div class="one-thirds, energyGallery">
    ENERGY PERSONNEL
    | <a href="?????">Clicking here generates [scrollGallery id=2] where scrollGallery1 currently exists</a>
    | <a href="?????">Clicking here generates [scrollGallery id=3] where scrollGallery1 currently exists</a>
    | <a href="?????">Clicking here generates [scrollGallery id=4] where scrollGallery1 currently exists</a>
    </div>

    So the template obviously splits the pate into 2/3rds and 1/3rds. In the 2/3rd section it automatically generates Gallery 1... On the right side its links to "Sub Galleries".. My question is how do I get the link to propagate in the same page without creating a separate template for each page.?

    I know I just must be thinking about this wrong... Hopefully someone can help me wrap my mind around this.

    Thanks in advance!

  2. vtxyzzy
    Member
    Posted 2 years ago #

    Can't be sure without testing, but this might work:

    <?php get_header('Energy'); ?>
    
    <?php $gallery = (isset($_GET['gallery'])) ? $_GET['gallery'] : 1; ?>
    <div class="two-thirds first">
    <?php echo do_shortcode("[scrollGallery id=$gallery]"); ?>
    </div>
    
    <div class="one-thirds, energyGallery">
    ENERGY PERSONNEL
    | <?php if ($gallery != 1)  { ?><a href="http://mysite.com/mygallery-page/?gallery=1">Clicking here generates [scrollGallery id=1] if scrollGallery1 is not on screen</a>
    <?php } ?>
    | <?php if ($gallery != 2)  { ?><a href="http://mysite.com/mygallery-page/?gallery=2">Clicking here generates [scrollGallery id=2] if scrollGallery2 is not on screen</a>
    <?php } ?>
    | <?php if ($gallery != 3)  { ?><a href="http://mysite.com/mygallery-page/?gallery=3">Clicking here generates [scrollGallery id=3] if scrollGallery3 is not on screen</a>
    <?php } ?>
    | <?php if ($gallery != 4)  { ?><a href="http://mysite.com/mygallery-page/?gallery=4">Clicking here generates [scrollGallery id=4] if scrollGallery4 is not on screen</a>
    <?php } ?>
    </div>

Topic Closed

This topic has been closed to new replies.

About this Topic