Skip to content


WordPress more-link(続きを読む)の#more-xxxx を削除する

このエントリーをはてなブックマークに追加
はてなブックマーク - WordPress more-link(続きを読む)の#more-xxxx を削除する
Share on Facebook
Post to Google Buzz
Bookmark this on Yahoo Bookmark
Bookmark this on Livedoor Clip
Share on FriendFeed
Share on GREE

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’ );
?>

関連するかもしれない記事



他のブログも読む

Posted in WordPress.

Tagged with , , , , .


One Response

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

Continuing the Discussion

  1. WordPress 「続きを読む」の#more-xxxと#extended - ITめもりーにょ linked to this post on 2009年12月17日

    [...] Older [...]



Some HTML is OK

or, reply to this post via trackback.

*