投稿主です。追加です。
・elevenだと抜粋の最後に「続きを見る→」が表示されますが、twelveでは[…]があるだけでリンク先に飛べません。
どうすればelevenと同じように「続きを見る→」を表示させ、リンク先に飛べますか?
よろしくお願いします。
・elevenだと抜粋の最後に「続きを見る→」が表示されますが、twelveでは[…]があるだけでリンク先に飛べません。
どうすればelevenと同じように「続きを見る→」を表示させ、リンク先に飛べますか?
この機能は、elevenから、twelveに受け継がれませんでした。
必要な場合は、自分でカスタマイズする必要があります。
カスタマイズは、
http://ja.forums.wordpress.org/topic/11385?replies=7
を参考にしてみてください
>nobitaさん
ご回答ありがとうございます。
twelveに引き継がれていないのは残念ですね。
カスタマイズ頑張ってみます!
改めて質問させて下さい。
●twetytwelveのトップページを記事の抜粋表示にするべく、content.phpの40行目辺りにある<?php the_content~~~?>を<?php the_excerpt~~~?>にしました。
すると、抜粋表示になったのですが、記事のタイトルをクリックして個別ページに飛ぶと、記事の全文は表示されず、抜粋状態での表示になってしまいます。
(同様に、ダッシュボード>投稿一覧で各記事のタイトルの下にある「表示」をクリックして個別ページに飛んでも同じ現象)
どうすれば、個別ページでは全文表示にすることができますか?
●トップページでの抜粋には「続きを読む→」が表示されないので、elevenのfunctions.phpの330行目~372行目辺りをtwelveのfunctions.phpにコピペして「続きを読む→」を表示させたのですが、この”→”を”…”に変更するにはどうすればいいでしょうか?そもそも、続きを読むを表示させるためにelevenのfunction.phpから上記部分をコピペした方法は正しい(望ましい)方法でしょうか?
どなたかご教授下さいますようお願い致します。
twetytwelveのトップページを記事の抜粋表示にするべく、content.phpの40行目辺りにある<?php the_content~~~?>を<?php the_excerpt~~~?>にしました。
single.phpが、the_excerptになっていませんか?
トップページでの抜粋には「続きを読む→」が表示されないので、elevenのfunctions.phpの330行目~372行目辺りをtwelveのfunctions.phpにコピペして「続きを読む→」を表示させたのですが、この”→”を”…”に変更するにはどうすればいいでしょうか?
行番号がおかしい気がしますが、違っていたら、なにをコピーして貼り付けたのか、書き込んでください。
/**
* Returns a "Continue Reading" link for excerpts
*/
function twentyeleven_continue_reading_link() {
return ' <a href="'. esc_url( get_permalink() ) . '">' . __( 'Continue reading <span class="meta-nav">→</span>', 'twentyeleven' ) . '</a>';
}
&rarr;を&hellip;(&を半角文字に変更してください)に変更してください。
>nobitaさん
ご回答ありがとうございます。
single.phpが、the_excerptになっていませんか?
single.phpにthe_excerpt、及び、the_contentはありませんでした。
代わりに、<?php get_template_part( ‘content’, get_post_format() ); ?>という記述がありましたので、content-page.phpなどのcontent-(~~~)と言うなのファイル全てを見ましたが、the_excerptはありませんでした。
&rarr;を&hellip;(&を半角文字に変更してください)に変更してください。
&rarr;を&hellip;に変えたところ、「続きを読む→」が「cotinue reading…」になりました。日本語への変換が機能しなくなるようです。
何かお分かりのことがありましたら、またご教授頂きたく存じます。
よろしくお願いします。
追加です。
twentyelevenのfunctions.phpファイルからtwelveにコピペした内容を記載します。
/**[…]を「続きを読む」に変更するためにelevenからコピペしてきた
* Sets the post excerpt length to 40 words.
*
* To override this length in a child theme, remove the filter and add your own
* function tied to the excerpt_length filter hook.
*/
function twentytwelve_excerpt_length( $length ) {
return 40;
}
add_filter( ‘excerpt_length’, ‘twentytwelve_excerpt_length’ );
if ( ! function_exists( ‘twentytwelve_continue_reading_link’ ) ) :
/**
* Returns a “Continue Reading” link for excerpts
*/
function twentytwelve_continue_reading_link() {
return ‘ ‘ . __( ‘Continue reading <span class=”meta-nav”>…</span>’, ‘twentytwelve’ ) . ‘‘;
}
endif; // twentytwelve_continue_reading_link
/**
* Replaces “[…]” (appended to automatically generated excerpts) with an ellipsis and twentytwelve_continue_reading_link().
*
* To override this in a child theme, remove the filter and add your own
* function tied to the excerpt_more filter hook.
*/
function twentytwelve_auto_excerpt_more( $more ) {
return ‘ …’ . twentytwelve_continue_reading_link();
}
add_filter( ‘excerpt_more’, ‘twentytwelve_auto_excerpt_more’ );
/**
* Adds a pretty “Continue Reading” link to custom post excerpts.
*
* To override this link in a child theme, remove the filter and add your own
* function tied to the get_the_excerpt filter hook.
*/
function twentytwelve_custom_excerpt_more( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= twentytwelve_continue_reading_link();
}
return $output;
}
add_filter( ‘get_the_excerpt’, ‘twentytwelve_custom_excerpt_more’ );
/*****ここまでがコピペ********
&rarr;を&hellip;に変えたところ、「続きを読む→」が「cotinue reading…」になりました。日本語への変換が機能しなくなるようです。
. __( 'Continue reading <span class="meta-nav">…</span>', 'twentytwelve' ) . '';
を
. '続きを読む <span class="meta-nav">…</span>' . '';
に変更すればいいですが、本来的には、ja.poを編集して、ja.moという翻訳ファイルを作る必要があります。
個別投稿も、excerptになる件ですが、確認してみたところ、
Twentytwelveは、個別投稿も、content.phpで表示している事が確認できました。
なので、the_excerpt()に条件分岐を付けるといいと思います。
if( is_front_page() or is_home() ){
the_excerpt();
}else{
the_content()
}
>nobitaさん
いつもありがとうございます
お世話になります
お陰様で、個別ページで記事を全文表示にすることができました!
感謝です!
“続きを読む”は、色々試したのですが、なぜかダメでした。
けど、英語表記でも問題があるわけではないので、この件に関してはとりあえず諦めます。
翻訳ファイルを作る技量もありませんので^^;
大きな問題が解決できて嬉しいです。
誠にありがとうございました!