• For some completely random reason, SOME tags are working and some aren’t working when I use the NextGen Gallery Tag-based galleries
    [ nggtags gallery=foxtrotting ]
    Images with the tag: “foxtrotting” are not showing up.
    I thought maybe because I originally had the tag called “fox trotting” so I took out the space in hopes of sinking it up but that didn’t help. So then I just added a totally brand new tag to one, called “rose” and then made a gallery based off of the tag “rose” but that doesn’t show up on the page either. Then I thought “maybe I just have too many galleries on a page,” and took one off but that didn’t make the “rose” or “foxtrotting” gallery show up either. HOW DO

    Just see here: https://tobylotak.com/gallerytest/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter thirdpotato

    (@thirdpotato)

    Okay so to anyone else having this problem:
    I’m using the Easel Theme
    Apparently you can’t use the same tag name in an image gallery, as you do for “chapter” slugs. For whatever reason, it’s messing that up. Any way to fix this?

    Thread Starter thirdpotato

    (@thirdpotato)

    Bumping topic in hopes of answers.

    EDIT: I saw that as of version 2.0.30, the problem has been solved!

    For everyone using an older version:

    The problem is, that the tags created for pictures are saved as slugs. So if you have a page or category or anything with the same slug, wordpress will save one of them as “myslug” and the other one as “myslug2”, numbering up at the end, if the slug already exists.

    So for the situation at hand: If your chapter / page etc. has the slug, say, “foxtrotting”, if you now define the “foxtrotting” tag for your pictures in the nextgen gallery, they will get the wordpress-internal slug “foxtrotting2”. Now when the nextgen gallery goes looking for the “foxtrotting” slug, it will return the entry of the chapter / page, not the images (which have received the slug “foxtrotting2”)!!

    Everything clear so far?

    So what I have done is change the relevant MySQL select withing the nextgen gallery, so that the correct entries are returned, not the mistaken ones:

    I’ve done the change for nextgen gallery 2.0.23. With a quick look at the previous ones (going back to the 1.9.*) they seem have the same issue.

    Now for the fix
    The file we’ll be working with is:
    nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery.php

    On line 724 we find the function get_term_ids_for_tags
    In this function there are 2 lines we want to modify:

    Replace
    $container_ids[]= "'{$container}'";
    with
    $container_ids[] = "slug LIKE '%%$container%%'";

    And replace
    $query = $wpdb->prepare("SELECT term_id FROM $wpdb->terms WHERE slug IN ({$container_ids}) ORDER BY term_id ASC ", NULL);
    with
    $query = $wpdb->prepare("SELECT term_id FROM $wpdb->terms INNER JOIN $wpdb->term_taxonomy USING (term_id) WHERE ($container_ids) AND taxonomy = 'ngg_tag' ORDER BY term_id ASC ", NULL);

    So what we’re doing here is changing the MySQL select statement from searching for the exact tag (i.e. “foxtrotting”), to being more open and also allowing entries that merely contain the exact tag (i.e. “foxtrotting2”). Then we check the ‘term_taxonomy’ table to see which ones belong to the nextgen gallery and return those.

    Voilà! Hope that solves the problem.

    If you have any questions or anything, just let me know.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: NEXTgen Gallery] Some tags not working in tag gallery!’ is closed to new replies.