Twenty Ten 1.1 の変更点とアップデートの注意点

Twenty Ten 1.1

Twenty Ten がバージョンアップして、1.1 になりました。 どこが変わったんだろう、と思っている方も多いかと思いますので、ソースを拾って変更点をまとめてみました。また、アップデートの際の注意点も合わせて書いてみたいと思います。

Twenty Ten 1.1 アップデートの注意点

変更点は長いので、まずはこちらから(笑)WordPress 3.0 日本語版を使っている場合、「ダッシュボード」の「アップデート」や、「テーマの管理」から Twenty Ten をアップデートすると、Twenty Ten テーマに関係するテキスト(メッセージ)の多くが英語になってしまいます。

これは、アップデートの際に、/wp-content/themes/twentyten/ 内のファイルはすべて削除されてしまうため、/wp-content/themes/twentyten/languages 内にある ja.mo ファイルもまた削除されてしまうためです。(これはテーマに限ったことではなく、プラグインでも同様です。プラグインでもともと用意されたものではない、画像などファイルをアップロードして利用するときは、プラグインディレクトリとは別のディレクトリに入れておくほうが良いでしょう。)

Twenty Ten 1.1 では、上の画像にも載っている、「テーマの管理」のところに表示されるテーマの説明文以外のメッセージは変更されていませんので、WordPress 3.0 日本語版にも入っている Twenty Ten 1.0 の ja.mo ファイルを /wp-content/themes/twentyten/languages にアップロードすれば問題ないと思います。

Twenty Ten 1.0 の ja.mo ファイルはこちらからダウンロードすることもできます

Twenty Ten 1.1 の変更点

まとめ:wp_title の処理を functions.php から header.php に移植しています。残りはコードの整形が大半で、style.css の変更も含めて、大きく機能や表示に影響を及ぼす変更は見受けられません。

twentyten
/images
/languages/twentyten.pot
404.php
archive.php
attachment.php
author.php
category.php
comments.php
editor-style.css
editor-style-rtl.css
footer.php
functions.php
header.php
index.php
license.txt
loop.php
onecolumn-page.php
page.php
rtl.css
search.php
sidebar.php
sidebar-footer.php
single.php
style.css
tag.php

/images

変更なし

/languages/twentyten.pot

テーマの管理で使われるテーマの説明文を以下の通り変更

The 2010 default theme for WordPress.

The 2010 theme for WordPress is stylish, customizable, simple, and readable — make it yours with a custom menu, header image, and background. Twenty Ten supports six widgetized areas (two in the sidebar, four in the footer) and featured images (thumbnails for gallery posts and custom header images for posts and pages). It includes stylesheets for print and the admin Visual Editor, special styles for posts in the “Asides” and “Gallery” categories, and has an optional one-column page template that removes the sidebar.
(訳:WordPress のテーマ「2010」は、スタイリッシュで、カスタマイズ可能で、簡潔で、読みやすく -- カスタムメニュー、ヘッダー画像、背景でサイトを作れます。Twenty Ten は6つのウィジェットエリア (サイドバーに2つ、フッターに4つ) と、アイキャッチ画像 (ギャラリー投稿のサムネイルと、投稿やページのカスタムヘッダー画像) に対応しています。印刷用、管理のビジュアルエディター用、"Asides" と "Gallery" カテゴリー用のスタイルシートが用意されています。また、サイドバーを取り去った1カラムのページのテンプレートもあります。 )

404.php

変更なし

archive.php

変更なし

attachment.php

class 指定の追加

<div id="container">

<div id="container" class="single-attachment">

親ページの ID が空でない場合に実行するよう、変更

                   <p class="page-title"><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="<?php esc_attr( printf( __( 'Return to %s', 'twentyten' ), get_the_title( $post->post_parent ) ) ); ?>" rel="gallery"><?php
                         /* translators: %s - title of parent post */
                         printf( __( '<span class="meta-nav">&larr;</span> %s', 'twentyten' ), get_the_title( $post->post_parent ) );
                    ?></a></p> 

                   <?php if ( ! empty( $post->post_parent ) ) : ?>
                         <p class="page-title"><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="<?php esc_attr( printf( __( 'Return to %s', 'twentyten' ), get_the_title( $post->post_parent ) ) ); ?>" rel="gallery"><?php
                              /* translators: %s - title of parent post */
                              printf( __( '<span class="meta-nav">&larr;</span> %s', 'twentyten' ), get_the_title( $post->post_parent ) );
                         ?></a></p>
                    <?php endif; ?>

author.php

変更なし

category.php

変更なし

comments.php

変更なし

editor-style.css

プロパティの色指定が大文字から小文字に変更

background-color: #E7E7E7;

background-color: #e7e7e7;
background: #FFFFCC;

background: #ffffcc;
color:#0066CC;

color:#0066cc;
color: #FF4B33;

color: #ff4b33;

editor-style-rtl.css

変更なし

footer.php

変更なし

functions.php

記事やページに合わせて wp_title を出し分けする処理をごっそり削除し、header.php に移植

 * Makes some changes to the <title> tag, by filtering the output of wp_title().
*
* If we have a site description and we're viewing the home page or a blog posts
* page (when using a static front page), then we will add the site description.
*
* If we're viewing a search result, then we're going to recreate the title entirely.
* We're going to add page numbers to all titles as well, to the middle of a search
* result title and the end of all other titles.
*
* The site title also gets added to all titles.
*
* @since Twenty Ten 1.0
*
* @param string $title Title generated by wp_title()
* @param string $separator The separator passed to wp_title(). Twenty Ten uses a
*      vertical bar, "|", as a separator in header.php.
* @return string The new title, ready for the <title> tag.
*/
function twentyten_filter_wp_title( $title, $separator ) {
     // Don't affect wp_title() calls in feeds.
     if ( is_feed() )
          return $title;

     // The $paged global variable contains the page number of a listing of posts.
     // The $page global variable contains the page number of a single post that is paged.
     // We'll display whichever one applies, if we're not looking at the first page.
     global $paged, $page;

     if ( is_search() ) {
          // If we're a search, let's start over:
          $title = sprintf( __( 'Search results for %s', 'twentyten' ), '"' . get_search_query() . '"' );
          // Add a page number if we're on page 2 or more:
          if ( $paged >= 2 )
               $title .= " $separator " . sprintf( __( 'Page %s', 'twentyten' ), $paged );
          // Add the site name to the end:
          $title .= " $separator " . get_bloginfo( 'name', 'display' );
          // We're done. Let's send the new title back to wp_title():
          return $title;
     }

     // Otherwise, let's start by adding the site name to the end:
     $title .= get_bloginfo( 'name', 'display' );

     // If we have a site description and we're on the home/front page, add the description:
     $site_description = get_bloginfo( 'description', 'display' );
     if ( $site_description && ( is_home() || is_front_page() ) )
          $title .= " $separator " . $site_description;

     // Add a page number if necessary:
     if ( $paged >= 2 || $page >= 2 )
          $title .= " $separator " . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );

     // Return the new title to wp_title():
     return $title;
}
add_filter( 'wp_title', 'twentyten_filter_wp_title', 10, 2 );

/** 

// 削除

header.php

functions.php より wp_title 処理を移植

      * We filter the output of wp_title() a bit -- see (wp_title() の出力をフィルターします。詳しくは
      * twentyten_filter_wp_title() in functions.php. (functions.php の twentyten_filter_wp_title() を参照してください。
      */
     wp_title( '|', true, 'right' ); 

      */
     global $page, $paged;

     wp_title( '|', true, 'right' );

     // Add the blog name. (ブログ名を追加します)
     bloginfo( 'name' );

     // Add the blog description for the home/front page. (ホーム/フロントページにブログの説明を追加します)
     $site_description = get_bloginfo( 'description', 'display' );
     if ( $site_description && ( is_home() || is_front_page() ) )
          echo " | $site_description";

     // Add a page number if necessary: (必要であればページナンバーを追加します)
     if ( $paged >= 2 || $page >= 2 )
          echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) ); 

index.php

変更なし

license.txt

変更なし

loop.php

HTML 部分 と PHP 部分のコードを整理してまとめた模様

<?php else : ?>
                    <div class="gallery-thumb">
<?php
     $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
     $total_images = count( $images );
     $image = array_shift( $images );
     $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
?>
                         <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
                    </div><!-- .gallery-thumb -->
                    <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>

                    <?php the_excerpt(); ?> 

<?php else : ?>               
                    <?php
                         $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
                         if ( $images ) :
                              $total_images = count( $images );
                              $image = array_shift( $images );
                              $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
                    ?>
                              <div class="gallery-thumb">
                                   <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
                              </div><!-- .gallery-thumb -->
                              <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>
                    <?php endif; ?>
                              <?php the_excerpt(); ?>

onecolumn-page.php

変更なし

page.php

どこが変わったのか、コアコミッター達のこだわりを感じてください(笑

* Please note that this is the wordpress construct of pages
* and that other 'pages' on your wordpress site will use a 

* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a 

?>の背後に大量のスペースがあったものを削除

                         <?php } else { ?>     
                              <h1 class="entry-title"><?php the_title(); ?></h1>
                         <?php } ?>                     

                         <?php } else { ?>
                              <h1 class="entry-title"><?php the_title(); ?></h1>
                         <?php } ?>

rtl.css

変更なし

search.php

変更なし

sidebar.php

変更なし

sidebar-footer.php

変更なし

single.php

変更なし

style.css

@charset の削除

@charset "utf-8";

/* 削除 */

width: 928px の指定を追加

div.menu {
     font-size: 13px;
     margin-left: 12px;
} 

div.menu {
     font-size: 13px;
     margin-left: 12px;
     width: 928px;
} 

clear: both; の指定を追加

#main { 
     overflow: hidden; 
     padding: 40px 0 0 0; 
} 

#main { 
     clear: both; 
     overflow: hidden; 
     padding: 40px 0 0 0; 
} 

class 指定の変更

.page .edit-link { 
     clear: both; 
     display: block; 
} 

body.page .edit-link { 
     clear: both; 
     display: block; 
} 

指定の丸ごと削除

.category-gallery { 
     margin-bottom: 48px; 
} 
.category-gallery h2 { 
     margin-top: 10px; 
} 
.category-gallery .entry-meta { 
} 

/* 削除 */
.home #content .category-gallery .entry-content p { 
     display: inline; 
} 

/* 削除 */
.entry-content .attachment img { 
     margin-bottom: 0; 
}

/* 削除 */

width、height の指定追加

#content img { 
     margin: 0; 
     max-width: 640px; 
} 

#content img { 
     margin: 0; 
     height: auto; 
     max-width: 640px; 
     width: auto; 
} 

margin 指定の変更

#content .gallery { 
     margin: auto; 
} 

#content .gallery { 
     margin: 0 auto 18px; 
} 

プロパティ指定の追加(添付画像がセンタリングされるように)

 

#content .attachment img { /* single attachment images should be centered */ 
     display: block; 
     margin: 0 auto; 
} 

上記以外の指定についても大量に変更されていますが、レイアウトやスタイルに影響するものはありません。以下のいずれかに該当するようになっていますので、例には初出の行を例として表示しておきます。

=の追加

/* Reset default browser CSS. Based on work by Eric Meyer: http://meyerweb.com/eric/tools/css/reset/index.html  

/* =Reset default browser CSS. Based on work by Eric Meyer: http://meyerweb.com/eric/tools/css/reset/index.html  

プロパティの指定をアルファベット順に変更

     margin: 0;
     padding: 0;
     border: 0;
     vertical-align: baseline;
     background: transparent;

     background: transparent;
     border: 0;
     margin: 0;
     padding: 0;
     vertical-align: baseline; 

プロパティの指定をフォーマット(改行)

a img { border: none; }

a img {
     border: none;
}

見出しの追加

 

/* =Layout
-------------------------------------------------------------- */ 

スペースを削除

/* Main global 'theme' and typographic styles  */  

/* Main global 'theme' and typographic styles */

プロパティをフォーマット(:の後にスペースを挿入)

     list-style:upper-alpha;

     list-style: upper-alpha;

プロパティの色指定が大文字から小文字に変更

     color:#0066CC;

     color: #0066cc;

プロパティの指定をアルファベット順に変更。但しサイズだけは width→height の順

#access ul ul a { 
     background:#333; 
     height:auto; 
     line-height:1em; 
     padding:10px; 
     width: 160px; 
} 
#access li:hover > a, 
#access ul ul :hover > a { 
     color:#fff; 
     background:#333; 
} 

#access ul ul a { 
     background: #333; 
     line-height: 1em; 
     padding: 10px; 
     width: 160px; 
     height: auto; 
} 
#access li:hover > a, 
#access ul ul :hover > a { 
     background: #333; 
     color: #fff; 
} 

tag.php

変更なし

このエントリーをはてなブックマークに追加このエントリのはてなブックマーク数このエントリをdel.icio.usに追加このエントリをLivedoor Clipに追加このエントリをYahoo!ブックマークに追加このエントリをFC2ブックマークに追加このエントリをNifty Clipに追加このエントリをPOOKMARK. Airlinesに追加このエントリをBuzzurl(バザール)に追加このエントリをChoixに追加このエントリをnewsingに追加Instapaper に保存するRead It Later に保存するこのエントリをつぶやくClip to Evernote

Twenty Ten 1.1 の変更点とアップデートの注意点” への10件のコメント

  1. ピンバック: Tweets that mention Twenty Ten 1.1 の変更点とアップデートの注意点 | Odysseygate.com -- Topsy.com

  2. ピンバック: Twenty Tenを1.1にアップデートしたら・・・ | mae's blog

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <img localsrc="" alt="">