Wordpressで特定の抜粋の「続きを読む」を削除するにはどうすればよいのでしょうか。私もphpを学ぼうとしているので、これは学ぶのに役立つ方法だと思いました
the_excerpt();
両方の場所で WP ループ内で使用しています。
functions.phpページにもこれらの行があります
function limerickfc_continue_reading_link() {
return ' <a href="'. esc_url( get_permalink() ) . '">' .
'<br />'.__( 'Read more ', 'limerickfc' ) . '</a>';
}
function limerickfc_custom_excerpt_more( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= limerickfc_continue_reading_link();
}
return $output;
}
add_filter( 'get_the_excerpt', 'limerickfc_custom_excerpt_more' );
呼び出されるたびにlimerickfc_custom_excerpt_more
が追加されると言うのは正しいですか? get_the_excerpt
このフィルターをループ内で一度だけ削除することは可能ですか?「続きを読む」をしたくないのですremove_filter( 'get_the_excerpt', 'limerickfc_custom_excerpt_more' );
が、ループ内で試しましたが、うまくいきませんでした。
どんな助けでもありがとう