Twenty Ten に WP hn Convert を適用したい

WordPress 3.0 のデフォルトテーマに、記事中では h3 と記述しているけど出力する場面によって h2 にしたりできるプラグイン WP hn Convert を適用したい!

<?php the_content(); ?>の部分を<?php the_hn_converted_content(-1); ?>と置き換え

【WordPressプラグイン】WP hn Convert: 見出しレベルを調整 « 7:3 blog

これでいけるそうなので、早速プラグインをアップロードして有効化、テーマファイルを編集しようとindex.php を開いてみると、

<div id="content" role="main">

<?php
/* Run the loop to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-index.php and that will be used instead.
*/
get_template_part( 'loop', 'index' );
?>
</div><!-- #content -->

中身がないっ!

loop.php に中身があると踏んで開いてみたものの難解過ぎてワケワカメなので、地道に class 名を変更して反映される箇所を調べる作戦でいきました。
div class=”entry-content” となっている部分を検索して div class=”entry-content11″ とかに変更、リロードしてトップページに反映される部分を探してみると L.136 が該当しました。
L.137 の the_content を the_hn_converted_content にするとよさげ!

<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>

L.137 はこのようになっていて、the_hn_converted_content の引数をどうやって指定したらいいのかわからん(´・ω・`)
試しに続きを読む部分の指定をまるっきりなくしてみたら the_hn_converted_content は動きました。

<?php the_hn_converted_content(1); ?>

引数の 1 をあっちこっちにくっつけているうちに動いたー!

<?php the_hn_converted_content( 1, __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>

すごく便利なプラグインなのにブクマされていなかったのはどうしてだろう・・・もしかして既に WordPress の基本機能として実装されてるとか?

この記事が最後に更新されたのは 2010年06月17日 18:21 です。

このページの先頭へ戻る

コメント(0)

コメントはありません

コメントをどうぞ

(公開されません)

トラックバック(0)

この記事は p15.jpTwenty Ten に WP hn Convert を適用したい です。
関連が低いと判断したトラックバックは予告無く削除させていただく場合がありますのでご了承ください。

トラックバックはありません

p15.jp について

このページの先頭へ戻る