• Jim R

    (@jim-r)


    In tagging my NextGen images, I’m trying to show the tagged images on that Tag’s archive page.

    $mf_query = <<<EOF
        SELECT t.*, tt.*, n.*
        FROM {$wpdb->term_relationships} as tr, {$wpdb->terms} AS t, {$wpdb->term_taxonomy} AS tt, {$wpdb->ngg_pictures} AS n
        WHERE tt.<code>taxonomy</code> = 'ngg_tag'
        AND n.<code>pid</code> = tr.<code>object_id</code>
        AND tr.<code>term_taxonomy_id</code> = tt.<code>term_taxonomy_id</code>
          AND tt.<code>term_id</code> = t.<code>term_id</code>
        ORDER BY rand()
        LIMIT 8
    EOF;
    
    $mf_terms = $wpdb->get_results( $mf_query );
    
        echo '<div class="gameCenter">
        <table width="100%" border="2" cellpadding="5">
       <thead><tr><th>
         Game Center
        </th></tr></thead>
       <tfoot><tr><td>
        .
         </td></tr></tfoot>
       <tbody>
       <tr>
        <td>
        <div id="gameCenter">';
    
    if( !empty( $mf_terms ) ) {
    
        foreach ( $mf_terms as $image  ) {
    
            echo '<a href="' . $image->imageURL . '" title="' . $image->pid . '"' .  $image->thumbcode . '>';
    
            echo '<img title="' . $image->alttext . '" alt="' . $image->alttext . '" src="' . $image->thumbnailURL . '"' . $image->size . '/>';
    
            }        
    
        }
    
        echo '</div></div>';
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Trying to link tagged photo to Tag Archive pages…’ is closed to new replies.