Support » Plugins » Call NextGEN Gallery directly from template

  • Hi guys, anyone know how to call NextGEN Gallery recent images directly from sidebar.php and home.php?

    I found this link ( but adding the below to my templates (and also without the variables) didn’t work.

    $number_of_pic = '4';
    $Width = '160';
    $Height = '160';
    if (function_exists(’nggDisplayRecentImages’))
    { nggDisplayRecentImages($number_of_pic,$Width,$Height); }

    If anyone’s figured this out I would really appreciate it. Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • I was having the exact same problem, and your question gave me the answer, so maybe I can help you. 2 things to check:

    1) that you have the NextGen Gallery Widget activated in addition to the NextGen plugin. The template functions are in the widget, so even if you are not using sidebar widgets, you need the widget activated.

    2) looking at your code, the single quote character is different in your line that checks if the function exists. If you copied the code directly from the webpage and edited in something like Notepad, you don’t have a single quote. You don’t need to declare the variables, just enclose the values in the function call in single quotes.


    With those changes, it worked for me.

    * nggDisplayRecentImages($number,$width,$height,$exclude,$list)
    * Function for templates without widget support
    * @return echo the widget content
    function nggDisplayRecentImages($number, $width = “75”, $height = “50”, $exclude = “all”, $list = “”) {

    $options[1] = array(‘title’=>”,
    ‘show’=>’thumbnail’ ,
    ‘list’=>$list );


    <?php if (function_exists(‘nggDisplayRecentImages’))
    { nggDisplayRecentImages(‘6′,’160′,’80’,’all’,”);
    (number, width, height, exclude and list)


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Call NextGEN Gallery directly from template’ is closed to new replies.