• Resolved pothound

    (@pothound)


    Thanks a lot for such a great plugin!
    I am using this code in my header.php template

    <?php do_action(‘slideshow_deploy’, ’14’); ?>

    Is there any chance I can add the page ID to it? So I could have different slide shows for each page?

    If yes, how do I do that? I tried with the page slug:

    <?php do_action(‘slideshow_deploy’, ’14’, ‘about-us’); ?>

    but that did not work.

    https://www.ads-software.com/plugins/slideshow-jquery-image-gallery/

Viewing 2 replies - 1 through 2 (of 2 total)
  • That’s a pretty complex request I think.
    The slideshow plugin has no way to know which slideshow should go on which page – you have to code that decision yourself.

    I think you’d need to make your own look-up-table, that says

    Page SlideShow_ID
    about-us 14
    about-them 25
    contact 12

    And do the look-up yourself (via PHP code in your template) to figure out which slideshow ID should be on which page.

    Possibly the easiest/fastest way to store the lookup table is as a static variable in the template.php file itself.

    So there’d be a variable something like:
    $LookUpTable = array( 'about-us' => '14', 'about-them' => '25', 'contact-us' => '12' )

    And then make your slideshow deploy code be something like:
    <?php do_action('slideshow_deploy', $LookUpTable[ the_shortlink() ] ); ?>
    Where the_shortlink() returns the short-link (eg. ‘about-us’) for the current page. That shortlink should match one of the keys in the $LookUpTable variable you created, and the code $LookUpTable[ the_shortlink() ] will be replaced by the value ’14’, ’25’ or ’12’ when the short-link for the current page matches a key in $LookUpTable.
    (If the_shortlink() isn’t found in the LookUpTable I think you’ll get an error.)

    Say, that’s just an untested guess – give it a shot!

    Thread Starter pothound

    (@pothound)

    Hi Demisjohn
    thanks for your help! Should have closed this request as I found out the solution, it works as you suggested ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Different Slideshows for Different Pages into Template’ is closed to new replies.