WordPressに標準装備されている「続きを読む」機能(more-link)ですが、個別記事のURLが「hogehoge/xxx.html#more-xxxx」のようにページ途中へのリンクになってしまうんですよね。
では、ページ上部を表示したい(#more-xxxをつけない)場合はどうしたら良いか、ちょっと調べてみました。
以下に記載します。
外観>編集のfunctions.phpの最後尾に以下のコードを追記するだけです。
<?php
// #more-$id を削除する。
function custom_content_more_link( $output ) {
$output = preg_replace(‘/#more-[\d]+/i’, ”, $output );
return $output;
}
add_filter( ‘the_content_more_link’, ‘custom_content_more_link’ );
?>
関連するかもしれない記事
- WordPress 「続きを読む」の#more-xxxと#extended
- eclipse -pleiadesプラグインで日本語化
- WordPress -特定カテゴリのみの最新記事をリスト表示する
- WordPressでトラックバックが送信できない
- eclipse -PHPプラグイン(PDT)のインストール
他のブログも読む



One Response
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
Continuing the Discussion