Is there a way to have nextgen gallery id dynamic?

I am creating a page template with the widgets hardcoded into the page and I am using the nextgen gallery for my photo gallery. Since each site can create multiple pages (using the template I am building), I need a way for the page to distinguish which gallery they want to use for each page. Normally, the user would have to manually change the shortcode for the widget and set it to whatever gallery they want. Is there a way to somehow trap the value of the gallery id when they select it on the upload photo screen (they select from a drop down to say what gallery to use) and then use that variable and dynamically change the id to the correct one? We are trying to make the site as user friendly as possible because it is going to be used by very non-technical people and we don't want them messing anything up so we are pretty much keeping them out of anything admin like.
Or if there is a different plugin I should use that would be easier, I'm game for that too (I just have to have this type of functionality though).

Any help on this would be greatly appreciated!

Thanks

Dustin

  • Dustin

    That's what I figured I would have to do. There is a table I can query called ngg_gallery (for each blog it has an individual table like wp_48_ngg_gallery) and I figured I could query it and show the results in a drop down list but for some reason I can't get the results to show up on the page. I can run the query against the database and it works fine though. This is how I am coding it on the page:

    <?php global $wpdb;?>
     <?php $gall = $wpdb->get_results( $wpdb->prepare( "SELECT gid
    , name
    FROM $wpdb->ngg_gallery") );
    foreach($gall as $row ) {
     echo $row->gid; }
    ?>

    Of course, this is just so I can see my results. It should be hitting the wp_48_ngg_gallery table but it's not showing any results. If I do the query on the db itself with

    SELECT gid
    , name
    FROM wp_48_ngg_gallery

    I show 2 rows. Any idea why this isn't working on the page itself? Is there a different way I have to do the code on the page?

    I plan on letting the person select which gallery they want to use on the page and then I'm going to use the result in a variable and make that the id in the code that calls the widget so it gets the correct one.

    Dustin

  • Dustin

    I have finally made some headway on this. I am using advanced custom fields plugins with the nextgen extensions for relationships and that adds a part under the manage galleries to link gallery to page and then I was able to run a sql query against the gallery table to get the gallery id of the gallery for the current page by comparing current page id to the page id in the gallery table and use that variable in the php shortcode in my template file. It seems to be working and it is completely dynamic. I can give better details to anyone who wants to know more or I might try and provide a little more detail later this week when everything slows down a little so hopefully someone else can take advantage of this as well.

    It really wasn't that bad to do once I found the correct items!

    Thanks

    Dustin

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.