Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Nothing to change if you use the ngggallery tag …

    [ngg gallery id=x template=caption] and all is ok with the 1.4.3 version and the default style, don’t know for other version

    Hi,

    I need exactly this function.
    I change the e funciton in the tags.php file like this (word in bold). I’m not a good php programer and i’m sure my code is not the better one, but the result is ok ??

    function find_images_for_tags($taglist, $mode = “ASC”) {
    // return the images based on the tag
    global $wpdb;

    // check separator ‘,’ or ‘+’
    if (strpos($taglist, ‘+’) === false) {
    // extract it into a array
    $taglist = explode(“,”, $taglist);
    $separ = false;
    } else {
    // extract it into a array
    $taglist = explode(“+”, $taglist);
    $separ = true;
    }

    if ( !is_array($taglist) )
    $taglist = array($taglist);

    $taglist = array_map(‘trim’, $taglist);
    $new_slugarray = array_map(‘sanitize_title’, $taglist);
    $sluglist = “‘” . implode(“‘, ‘”, $new_slugarray) . “‘”;

    // first get all $term_ids with this tag
    $term_ids = $wpdb->get_col( $wpdb->prepare(“SELECT term_id FROM $wpdb->terms WHERE slug IN ($sluglist) ORDER BY term_id ASC “));
    if ( $separ ) {
    $picids = get_objects_in_term($term_ids[0], ‘ngg_tag’);
    for ( $i=1; $i<count($term_ids); $i++ ){
    $picids = array_intersect($picids, get_objects_in_term($term_ids[$i], ‘ngg_tag’));
    }
    } else {
    $picids = get_objects_in_term($term_ids, ‘ngg_tag’);
    }

    //Now lookup in the database
    if ($mode == ‘RAND’)
    $pictures = nggdb::find_images_in_list($picids, true, ‘RAND’ );
    else
    $pictures = nggdb::find_images_in_list($picids, true, ‘ASC’ );

    return $pictures;
    }

    using the tags is now :
    [nggtags gallery=thailand,rate_1] the same as before !
    [nggtags gallery=thailand+rate_1] only picture with the two tags

    hope this help

    Thread Starter trDiablo

    (@trdiablo)

    Find solution, but need some code modification :

    in nggfunctions.php change text in bold

    function nggShowGalleryTags($taglist, $template = ”) {

    // $_GET from wp_query
    $pid = get_query_var(‘pid’);
    $pageid = get_query_var(‘pageid’);

    // get now the related images
    $picturelist = nggTags::find_images_for_tags($taglist , ‘ASC’);

    // look for ImageBrowser if we have a $_GET(‘pid’)
    if ( $pageid == get_the_ID() || !is_home() )
    if (!empty( $pid )) {
    foreach ($picturelist as $picture) {
    $picarray[] = $picture->pid;
    }
    $out = nggCreateImageBrowser($picarray);
    return $out;
    }

    // go on if not empty
    if ( empty($picturelist) )
    return;

    // show gallery
    if ( is_array($picturelist) )
    $out = nggCreateGallery($picturelist, false, $template);

    $out = apply_filters(‘ngg_show_gallery_tags_content’, $out, $taglist);
    return $out;
    }

    in shortcode.php

    function show_tags( $atts ) {

    extract(shortcode_atts(array(
    ‘gallery’ => ”,
    ‘template’ => ”,
    ‘album’ => ”
    ), $atts ));

    if ( !empty($album) )
    $out = nggShowAlbumTags($album);
    else
    $out = nggShowGalleryTags($gallery, $template);

    return $out;
    }

    and you can do the same thing with nggShowAlnumTags i think if you use it ??

    Hi,

    you can use [ngg gallery id=x template=caption] and change the gallery-caption.php file or the css if necessary.

    Hi,

    You need to use [ngg gallery id=x template=caption] and play with the gallery-caption.php file.

Viewing 5 replies - 1 through 5 (of 5 total)