WordPress.org

Ready to get started?Download WordPress

Forums

Trying to link tagged photo to Tag Archive pages... (2 posts)

  1. Jim R
    Member
    Posted 4 years ago #

    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>';
  2. Jim R
    Member
    Posted 4 years ago #

    :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags