What I'd like to do is if the NextGEN gallery has more than one page (pagination) execute some code...I got close:

    $nggpage  = get_query_var('nggpage');
    if ($nggpage > 1) {
        echo "duck";

This code appears on all pages but the first page, how do I make it work on the first page? Because if I use $nggpage >= 1 it executes the code on all pages, even if there is no pagination...I want it to only execute the code if there is pagination.

Any ideas?


  • This really is a plugin specific question and is off topic, but how about >0?
    – s_ha_dum
    Oct 3, 2014 at 16:12

1 Answer 1


I figured it out!!

My final code looks like:

    $images = intval($wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures"));
    $ngg_options = nggGallery::get_option("ngg_options");
    $maxElement = $ngg_options["galImages"];
    if ($images > $maxElement) {
        echo "duck";

Basically the code checks see if the number of images IS larger than the number of images displayed per page...if it is larger I echo what I want it to do...if not, it does nothing.

Not the answer you're looking for? Browse other questions tagged or ask your own question.