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
テーマの管理で使われるテーマの説明文を以下の通り変更
[text firstline=”421″]The 2010 default theme for WordPress.[/text]
↓
[text firstline=”416″]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カラムのページのテンプレートもあります。 )
[/text]
404.php
変更なし
archive.php
変更なし
attachment.php
class 指定の追加
1 |
<div id="container"> |
↓
1 |
<div id="container" class="single-attachment"> |
親ページの ID が空でない場合に実行するよう、変更
1 2 3 4 |
<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">←</span> %s', 'twentyten' ), get_the_title( $post->post_parent ) ); ?></a></p> |
↓
1 2 3 4 5 6 |
<?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">←</span> %s', 'twentyten' ), get_the_title( $post->post_parent ) ); ?></a></p> <?php endif; ?> |
author.php
変更なし
category.php
変更なし
comments.php
変更なし
editor-style.css
プロパティの色指定が大文字から小文字に変更
1 |
background-color: #E7E7E7; |
↓
1 |
background-color: #e7e7e7; |
1 |
background: #FFFFCC; |
↓
1 |
background: #ffffcc; |
1 |
color:#0066CC; |
↓
1 |
color:#0066cc; |
1 |
color: #FF4B33; |
↓
1 |
color: #ff4b33; |
editor-style-rtl.css
変更なし
footer.php
変更なし
functions.php
記事やページに合わせて wp_title を出し分けする処理をごっそり削除し、header.php に移植
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
* 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 ); /** |
↓
1 |
// 削除 |
header.php
functions.php より wp_title 処理を移植
1 2 3 4 |
* 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' ); |
↓
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
*/ 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 部分のコードを整理してまとめた模様
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<?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(); ?> |
↓
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?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
どこが変わったのか、コアコミッター達のこだわりを感じてください(笑
1 2 |
* Please note that this is the wordpress construct of pages * and that other 'pages' on your wordpress site will use a |
↓
1 2 |
* Please note that this is the WordPress construct of pages * and that other 'pages' on your WordPress site will use a |
?>の背後に大量のスペースがあったものを削除
1 2 3 |
<?php } else { ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php } ?> |
↓
1 2 3 |
<?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 の削除
1 |
@charset "utf-8"; |
↓
1 |
/* 削除 */ |
width: 928px の指定を追加
1 2 3 4 |
div.menu { font-size: 13px; margin-left: 12px; } |
↓
1 2 3 4 5 |
div.menu { font-size: 13px; margin-left: 12px; width: 928px; } |
clear: both; の指定を追加
1 2 3 4 |
#main { overflow: hidden; padding: 40px 0 0 0; } |
↓
1 2 3 4 5 |
#main { clear: both; overflow: hidden; padding: 40px 0 0 0; } |
class 指定の変更
1 2 3 4 |
.page .edit-link { clear: both; display: block; } |
↓
1 2 3 4 |
body.page .edit-link { clear: both; display: block; } |
指定の丸ごと削除
1 2 3 4 5 6 7 8 |
.category-gallery { margin-bottom: 48px; } .category-gallery h2 { margin-top: 10px; } .category-gallery .entry-meta { } |
↓
1 |
/* 削除 */ |
1 2 3 |
.home #content .category-gallery .entry-content p { display: inline; } |
↓
1 |
/* 削除 */ |
1 2 3 |
.entry-content .attachment img { margin-bottom: 0; } |
↓
1 |
/* 削除 */ |
width、height の指定追加
1 2 3 4 |
#content img { margin: 0; max-width: 640px; } |
↓
1 2 3 4 5 6 |
#content img { margin: 0; height: auto; max-width: 640px; width: auto; } |
margin 指定の変更
1 2 3 |
#content .gallery { margin: auto; } |
↓
1 2 3 |
#content .gallery { margin: 0 auto 18px; } |
プロパティ指定の追加(添付画像がセンタリングされるように)
1 |
↓
1 2 3 4 |
#content .attachment img { /* single attachment images should be centered */ display: block; margin: 0 auto; } |
上記以外の指定についても大量に変更されていますが、レイアウトやスタイルに影響するものはありません。以下のいずれかに該当するようになっていますので、例には初出の行を例として表示しておきます。
=の追加
1 |
/* Reset default browser CSS. Based on work by Eric Meyer: http://meyerweb.com/eric/tools/css/reset/index.html |
↓
1 |
/* =Reset default browser CSS. Based on work by Eric Meyer: http://meyerweb.com/eric/tools/css/reset/index.html |
プロパティの指定をアルファベット順に変更
1 2 3 4 5 |
margin: 0; padding: 0; border: 0; vertical-align: baseline; background: transparent; |
↓
1 2 3 4 5 |
background: transparent; border: 0; margin: 0; padding: 0; vertical-align: baseline; |
プロパティの指定をフォーマット(改行)
1 |
a img { border: none; } |
↓
1 2 3 |
a img { border: none; } |
見出しの追加
1 |
↓
1 2 |
/* =Layout -------------------------------------------------------------- */ |
スペースを削除
1 |
/* Main global 'theme' and typographic styles */ |
↓
1 |
/* Main global 'theme' and typographic styles */ |
プロパティをフォーマット(:の後にスペースを挿入)
1 |
list-style:upper-alpha; |
↓
1 |
list-style: upper-alpha; |
プロパティの色指定が大文字から小文字に変更
1 |
color:#0066CC; |
↓
1 |
color: #0066cc; |
プロパティの指定をアルファベット順に変更。但しサイズだけは width→height の順
1 2 3 4 5 6 7 8 9 10 11 12 |
#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; } |
↓
1 2 3 4 5 6 7 8 9 10 11 12 |
#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
変更なし
ピンバック: Tweets that mention Twenty Ten 1.1 の変更点とアップデートの注意点 | Odysseygate.com -- Topsy.com
ピンバック: Twenty Tenを1.1にアップデートしたら・・・ | mae's blog
どこが変わったんだろう、と思っていた一人ですw
変更点と注意点ありがとうございます、とても参考になりました!!
>MakeGoodTime さん
お役に立てば何よりです~!