Make WordPress Core


Ignore:
Timestamp:
02/13/2010 09:59:16 AM (15 years ago)
Author:
dd32
Message:

Remove Direct SQL, Use new esc_html() function, Correct the case of the ID keys. See #9015

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyten/index.php

    r13060 r13105  
    2525
    2626            <div class="entry-content">
    27                 <div class="gallery-thumb"><a class="size-thumbnail" href="<?php permalink_link() ?>"><?php $hilite = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_type = 'attachment' LIMIT 1" ); echo wp_get_attachment_image( $hilite, 'thumbnail' );?></a></div>
    28 
    29                 <p><em><?php printf( __('This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten'), 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__('Permalink to %s', 'twentyten'), the_title_attribute('echo=0') ) . '" rel="bookmark"', $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_type = 'attachment'" )); ?></em></p>
     27                <div class="gallery-thumb"><a class="size-thumbnail" href="<?php permalink_link() ?>"><?php
     28                $images =& get_children( array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999) );
     29                $total_images = count($images);
     30                $image = array_shift($images);
     31                echo wp_get_attachment_image( $image->ID, 'thumbnail' );
     32                ?></a></div>
     33                <p><em><?php printf( __('This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten'), 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__('Permalink to %s', 'twentyten'), the_title_attribute('echo=0') ) . '" rel="bookmark"', $total_images ); ?></em></p>
    3034
    3135                <?php the_excerpt(''); ?>
Note: See TracChangeset for help on using the changeset viewer.