Take the 2-minute tour ×
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:

<?php
    $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?

Thanks,
Josh

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

I figured it out!!

My final code looks like:

<?php
    $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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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