Make WordPress Core

Ticket #21230: 21230.diff

File 21230.diff, 6.0 KB (added by obenland, 13 years ago)
  • wp-content/themes/twentytwelve/image.php

     
    2020
    2121                                                <footer class="entry-meta">
    2222                                                        <?php
    23                                                                 $metadata = wp_get_attachment_metadata();
     23                                                                $twentytwelve_metadata = wp_get_attachment_metadata();
    2424                                                                printf( __( '<span class="meta-prep meta-prep-entry-date">Published </span> <span class="entry-date"><time class="entry-date" datetime="%1$s" pubdate>%2$s</time></span> at <a href="%3$s" title="Link to full-size image">%4$s &times; %5$s</a> in <a href="%6$s" title="Return to %7$s" rel="gallery">%8$s</a>', 'twentytwelve' ),
    2525                                                                        esc_attr( get_the_date( 'c' ) ),
    2626                                                                        esc_html( get_the_date() ),
    2727                                                                        esc_url( wp_get_attachment_url() ),
    28                                                                         $metadata['width'],
    29                                                                         $metadata['height'],
     28                                                                        $twentytwelve_metadata['width'],
     29                                                                        $twentytwelve_metadata['height'],
    3030                                                                        esc_url( get_permalink( $post->post_parent ) ),
    3131                                                                        esc_attr( strip_tags( get_the_title( $post->post_parent ) ) ),
    3232                                                                        get_the_title( $post->post_parent )
     
    5050 * Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery,
    5151 * or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file
    5252 */
    53 $attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
    54 foreach ( $attachments as $k => $attachment ) {
    55         if ( $attachment->ID == $post->ID )
     53$twentytwelve_attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
     54foreach ( $twentytwelve_attachments as $twentytwelve_k => $twentytwelve_attachment ) {
     55        if ( $twentytwelve_attachment->ID == $post->ID )
    5656                break;
    5757}
    58 $k++;
     58$twentytwelve_k++;
    5959// If there is more than 1 attachment in a gallery
    60 if ( count( $attachments ) > 1 ) {
    61         if ( isset( $attachments[ $k ] ) )
     60if ( count( $twentytwelve_attachments ) > 1 ) {
     61        if ( isset( $twentytwelve_attachments[ $twentytwelve_k ] ) )
    6262                // get the URL of the next image attachment
    63                 $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
     63                $twentytwelve_next_attachment_url = get_attachment_link( $twentytwelve_attachments[ $twentytwelve_k ]->ID );
    6464        else
    6565                // or get the URL of the first image attachment
    66                 $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID );
     66                $twentytwelve_next_attachment_url = get_attachment_link( $twentytwelve_attachments[ 0 ]->ID );
    6767} else {
    6868        // or, if there's only 1 image, get the URL of the image
    69         $next_attachment_url = wp_get_attachment_url();
     69        $twentytwelve_next_attachment_url = wp_get_attachment_url();
    7070}
    7171?>
    72                                                                 <a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php
    73                                                                 $attachment_size = apply_filters( 'twentytwelve_attachment_size', array( 960, 960 ) );
    74                                                                 echo wp_get_attachment_image( $post->ID, $attachment_size );
     72                                                                <a href="<?php echo esc_url( $twentytwelve_next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php
     73                                                                $twentytwelve_attachment_size = apply_filters( 'twentytwelve_attachment_size', array( 960, 960 ) );
     74                                                                echo wp_get_attachment_image( $post->ID, $twentytwelve_attachment_size );
    7575                                                                ?></a>
    7676
    7777                                                                <?php if ( ! empty( $post->post_excerpt ) ) : ?>
  • wp-content/themes/twentytwelve/functions.php

     
    103103         * JavaScript for handling navigation menus and the resized
    104104         * styles for small screen sizes.
    105105         */
    106         wp_enqueue_script( 'navigation', get_template_directory_uri() . '/js/theme.js', array( 'jquery' ), '20130320', true );
     106        wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/theme.js', array( 'jquery' ), '20130320', true );
    107107
    108108        /**
    109109         * Load special font CSS file.
     
    111111         */
    112112        $options = $twentytwelve_options->get_theme_options();
    113113        if ( $options['enable_fonts'] )
    114                 wp_enqueue_style( 'fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700' );
     114                wp_enqueue_style( 'twentytwelve-fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700' );
    115115
    116116        /**
    117117         * Load our main CSS file.
  • wp-content/themes/twentytwelve/archive.php

     
    3030                                        // Show an optional tag description
    3131                                        $tag_description = tag_description();
    3232                                        if ( $tag_description )
    33                                                 echo apply_filters( 'tag_archive_meta', '<div class="tag-archive-meta">' . $tag_description . '</div>' );
     33                                                echo apply_filters( 'twentytwelve_tag_archive_meta', '<div class="tag-archive-meta">' . $tag_description . '</div>' );
    3434                                } elseif ( is_category() ) {
    3535                                        printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' );
    3636                                        // Show an optional category description
    3737                                        $category_description = category_description();
    3838                                        if ( $category_description )
    39                                                 echo apply_filters( 'category_archive_meta', '<div class="category-archive-meta">' . $category_description . '</div>' );
     39                                                echo apply_filters( 'twentytwelve_category_archive_meta', '<div class="category-archive-meta">' . $category_description . '</div>' );
    4040                                } else {
    4141                                        _e( 'Blog Archives', 'twentytwelve' );
    4242                                }