WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: NextGEN Gallery] PHP to use Nextgen in Themes (9 posts)

  1. Degrama
    Member
    Posted 5 years ago #

    Hello,

    I must be blind because all I can find are shortcode examples which are used in wordpress.

    Does anyone know how I can call nextgen via php particularly an Album.

    Thanks!

  2. stefan-vizion
    Member
    Posted 5 years ago #

    Our resident PHP genius, Scott Kingsley Clark, found this hidden in the plugin. This is how you can pull a gallery, slideshow or album into a template via PHP hook:

    <?php echo nggShowSlideshow([id],[width],[height]); ?>

    Let me know if that works

  3. Degrama
    Member
    Posted 5 years ago #

    yes an no, your answer generated errors not sure why but i googled

    nggShowSlideshow

    and come up with

    function nggShowAlbum($albumID,$mode = "extend")

    =

    <?php echo nggShowAlbum(1) ?>

    And yes that works!

  4. zerocelsius13
    Member
    Posted 5 years ago #

    <?php echo nggShowSlideshow([id],[width],[height]); ?>

    This works for me. Just had to replace the entire [id],[width],[height], with values like so:

    <?php echo nggShowSlideshow(1,120,120); ?>

    I do have the JW Image Rotator, so it's working great now. Thanks for the suggestion stefan-vizion.

    -Ben

  5. Kruemel
    Member
    Posted 5 years ago #

    Are there more php codes I can use for NextGen?
    For example to show the latest 4 images of a special gallery?

  6. adamholz
    Member
    Posted 5 years ago #

    You can look in nggfunctions.php to identify all the NextGen functions, see the parameters used, and try calling them in your php files. you can also use <?php echo do_shortcode('[album=1 template=compact]'); ?>

  7. andreas.h
    Member
    Posted 4 years ago #

    I use <?php echo nggShowSlideshow(1,120,120); ?> and have the JW Image Rotator.

    Showing two slideshows in the header from two diffrent gallerys, all works fine, until you go to a sub page then the slideshow doesnt display!?

    The homepage and all first level pages work fine!

    Any ideas of what the problem can be!?

  8. Alex Rabe
    Member
    Posted 4 years ago #

    have you included wp_head on the theme header ?

  9. The J
    Member
    Posted 4 years ago #

    I just dont understand why there's a nice documentation about shortcodes but not php functions.

    I mainly work with php and custom template pages... how am I supposed to work with shortcodes... ok I can look in the core files and extract the functions I need... but I just dont understand why the same documentation wasn't done for php functions too.

    Guess the easiest thing to do, to show Album n.1 for example, is:

    <?php echo do_shortcode('[nggallery id=1]'); ?>

    Just get the normal shortcode in there and let wordpress core functions sort it out :D

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.