WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
[resolved] Short Code Question (9 posts)

  1. joshjohnloz
    Member
    Posted 3 years ago #

    Hello Everyone,

    I apologize that I have not searched extensively through the forum for this answer, if this topic is already here...please provide the link.

    I want to display a certain number of random images from a specific NGG gallery within page content, much as the sidebar widget displays random images. I do not want duplicates.

    For example if I have 6 divs setup as containers, what is the short code I need to insert in each div to accomplish this?

    Alternatively, if there is php function to call random (non-duplicate) images from a gallery...please provide that code snippet and I can write my own function to accomplish my goal.

    Thanks in advance for your time and attention. I will of course provide my solution to Alex so that he can integrate if he chooses.

    Thanks,

    Josh Johnloz

  2. Alex Rabe
    Member
    Posted 3 years ago #

    This is the shortcode to show 5 images from gallery 1 :

    [random max="5" id="1" /]

    php code is :

    <?php echo nggShowRandomRecent('random', 5, '' , 1) ?>

    Hope this helps

  3. madC.at
    Member
    Posted 3 years ago #

    Hallelujah!! I was banging my head with something similar.. and tried all the stuff i could think about .. and didn't fix it ...

    But now it's fixed! :D

    Thank you!

  4. joshjohnloz
    Member
    Posted 3 years ago #

    Awesome!

    This totally worked Alex.

    Not to be a bother, but it seems when I use this shortcode, the images are displayed at the default thumbnail size. Is there a way that I can define the size of each image by passing another value in the shortcode?

    I'd like to be able to use this same technique for other areas of my site, and would like the image(s) to display at a larger size.

    Thanks for getting back so quickly!

    Josh

  5. Alex Rabe
    Member
    Posted 3 years ago #

    No this is not possible

  6. joshjohnloz
    Member
    Posted 3 years ago #

    Cool...I just wanted to ask before I dug into this. I love your plugin. Everyone who has used a blog I've put together says how easy it is to use and comments about how much they like the advanced features.

    I'm a bit busy in the next month or so, but I'm a QA engineer by trade. If you have any future releases that require testing, I'd be happy to bang on it before you GM. Just let me know. The best email for contacting me is joshjohnloz@gmail.com.

    Thanks,

    Josh

  7. Alex Rabe
    Member
    Posted 3 years ago #

    Thank, just have a from time to time a look on my page, I release always a beta & RC before release

  8. nabil_kadimi
    Member
    Posted 3 years ago #

    @joshjohnloz

    You can set the thumbnail size in the options instead.

  9. joshjohnloz
    Member
    Posted 3 years ago #

    @nabil_kadimi

    LOL

    7 months and about 70000 lines of code later...Absolutely, but what I wanted to do was specify a different thumbnail size for a set of images elsewhere in the site. Essentially supporting a mini-gallery with images that are different from the default size. I don't remember my exact solution, but I think I wrapped the php code Alex provided in a div and used .css to style the images and containers.

    Thanks and good luck!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.