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

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

[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 指定の追加

[html firstline=”12″]<div id="container">[/html]

[html firstline=”12″]<div id="container" class="single-attachment">[/html]

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

[php firstline=”17″]
<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]

[php firstline=”17″]
<?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; ?>
[/php]

author.php

変更なし

category.php

変更なし

comments.php

変更なし

editor-style.css

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

[css firstline=”42″]background-color: #E7E7E7;[/css]

[css firstline=”42″]background-color: #e7e7e7;[/css]

[css firstline=”98″]background: #FFFFCC;[/css]

[css firstline=”98″]background: #ffffcc;[/css]

[css firstline=”145″]color:#0066CC;[/css]

[css firstline=”145″]color:#0066cc;[/css]

[css firstline=”152″]color: #FF4B33;[/css]

[css firstline=”152″]color: #ff4b33;[/css]

editor-style-rtl.css

変更なし

footer.php

変更なし

functions.php

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

[php firstline=”207″]
* 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 );

/**
[/php]

[php firstline=”207″]// 削除[/php]

header.php

functions.php より wp_title 処理を移植

[php firstline=”18″]
* 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’ );
[/php]

[php firstline=”18″]
*/
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 ) );
[/php]

index.php

変更なし

license.txt

変更なし

loop.php

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

[php firstline=”71″]
<?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]

[php firstline=”71″]
<?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(); ?>
[/php]

onecolumn-page.php

変更なし

page.php

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

[php firstline=”6″]
* Please note that this is the wordpress construct of pages
* and that other ‘pages’ on your wordpress site will use a
[/php]

[php firstline=”6″]
* Please note that this is the WordPress construct of pages
* and that other ‘pages’ on your WordPress site will use a
[/php]

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

[php firstline=”25″]
<?php } else { ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php } ?>
[/php]

[php firstline=”25″]
<?php } else { ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php } ?>
[/php]

rtl.css

変更なし

search.php

変更なし

sidebar.php

変更なし

sidebar-footer.php

変更なし

single.php

変更なし

style.css

@charset の削除

[css firstline=”1″]@charset "utf-8";[/css]

[css firstline=”1″]/* 削除 */[/css]

width: 928px の指定を追加

[css firstline=”383″]
div.menu {
font-size: 13px;
margin-left: 12px;
}
[/css]

[css firstline=”377″]
div.menu {
font-size: 13px;
margin-left: 12px;
width: 928px;
}
[/css]

clear: both; の指定を追加

[css firstline=”456″]
#main {
overflow: hidden;
padding: 40px 0 0 0;
}
[/css]

[css firstline=”451″]
#main {
clear: both;
overflow: hidden;
padding: 40px 0 0 0;
}
[/css]

class 指定の変更

[css firstline=”663″]
.page .edit-link {
clear: both;
display: block;
}
[/css]

[css firstline=”659″]
body.page .edit-link {
clear: both;
display: block;
}
[/css]

指定の丸ごと削除

[css firstline=”737″]
.category-gallery {
margin-bottom: 48px;
}
.category-gallery h2 {
margin-top: 10px;
}
.category-gallery .entry-meta {
}

[/css]

[css firstline=”729″]
/* 削除 */
[/css]

[css firstline=”754″]
.home #content .category-gallery .entry-content p {
display: inline;
}
[/css]

[css firstline=”739″]
/* 削除 */
[/css]

[css firstline=”765″]
.entry-content .attachment img {
margin-bottom: 0;
}
[/css]

[css firstline=”746″]
/* 削除 */
[/css]

width、height の指定追加

[css firstline=”784″]
#content img {
margin: 0;
max-width: 640px;
}
[/css]

[css firstline=”762″]
#content img {
margin: 0;
height: auto;
max-width: 640px;
width: auto;
}
[/css]

margin 指定の変更

[css firstline=”835″]
#content .gallery {
margin: auto;
}
[/css]

[css firstline=”815″]
#content .gallery {
margin: 0 auto 18px;
}
[/css]

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

[css firstline=”861″]

[/css]

[css firstline=”841″]
#content .attachment img { /* single attachment images should be centered */
display: block;
margin: 0 auto;
}
[/css]

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

=の追加

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

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

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

[css firstline=”24″]
margin: 0;
padding: 0;
border: 0;
vertical-align: baseline;
background: transparent;
[/css]

[css firstline=”23″]
background: transparent;
border: 0;
margin: 0;
padding: 0;
vertical-align: baseline;
[/css]

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

[css firstline=”55″]
a img { border: none; }
[/css]

[css firstline=”54″]
a img {
border: none;
}
[/css]

見出しの追加

[css firstline=”55″]

[/css]

[css firstline=”58″]
/* =Layout
————————————————————– */
[/css]

スペースを削除

[css firstline=”202″]
/* Main global ‘theme’ and typographic styles */
[/css]

[css firstline=”200″]
/* Main global ‘theme’ and typographic styles */
[/css]

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

[css firstline=”235″]
list-style:upper-alpha;
[/css]

[css firstline=”232″]
list-style: upper-alpha;
[/css]

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

[css firstline=”318″]
color:#0066CC;
[/css]

[css firstline=”314″]
color: #0066cc;
[/css]

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

[css firstline=”423″]
#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;
}
[/css]

[css firstline=”418″]
#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;
}
[/css]

tag.php

変更なし


“Twenty Ten 1.1 の変更点とアップデートの注意点” への4件のフィードバック

フォームは コメントしてほしそうに こちらを見ている……!

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください

%d人のブロガーが「いいね」をつけました。