Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?


share|improve this question

closed as off-topic by birgire, Johannes Pille, s_ha_dum Oct 3 '14 at 16:12

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

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

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer

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