WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
[resolved] nggShowRandomRecent -> template (7 posts)

  1. Elan42.com
    Member
    Posted 2 years ago #

    Hi, How do I create a template for nggShowRandomRecent ?
    I want to echo the image at full size with no link in it ...

    I also don't understand where a full guide/manual about Nextgen Gallery is.

    From google:
    //Show 6 random images using 'my-template' from gallery 4
    //(order, number of images, template, gallery ID)
    echo nggShowRandomRecent('random', 6, 'my-template', 4);

    I want to customize "my-template".

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. Elan42.com
    Member
    Posted 2 years ago #

    The behaviour is odd... if I use:
    echo nggShowRandomRecent('random', 1, '', 1);

    It works but shows a "default-templated" picture, I need to customize it.

    If I use:
    echo nggShowRandomRecent('random', 1, 'mytemplate', 1);

    It don't works (tryed to copy from singlepic.php): the $image array is NULL.

  3. Elan42.com
    Member
    Posted 2 years ago #

    In the end, I created a function myself copying from nggShowRandomRecent to get random image from ngg gallery.

    My target was to have a random image title for the blog / website.

    function NggRandom($galleryId = 0) {
    
        // get now the recent or random images
        $picturelist = nggdb::get_random_images(1, $galleryId);
    
    $out = '<a href="'.get_bloginfo('url').'" title="'.get_bloginfo('name').'"><img src="'.$picturelist[0]->imageURL.'" title="'.get_bloginfo('name').'" alt="'.get_bloginfo('name').'" /></a>';
    
        return $out;
    }

    Of course the template tag is:
    <?php echo NggRandom (ID); ?>

  4. matstillo
    Member
    Posted 2 years ago #

    Nice one! This has always been a tricky thing with NextGen, & I have often had to hack the core plugin files.

    This method is so simple, thanks heaps for posting your findings

  5. Vajaah
    Member
    Posted 1 year ago #

    Nokao -- just a major thank you for the random image function. It was exactly what I needed for the gallery template I was creating! So grateful that I don't have to edit the plugin files! Thanks!

  6. Shreyo
    Member
    Posted 1 year ago #

    @Nokao

    thanks a lot. you saved me.

  7. Elan42.com
    Member
    Posted 1 year ago #

    wow :)

    youre wellcome

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic