<?php
/*
Plugin Name: Custom more text
Plugin URI: 
Description: 「続きを読む」のテキストをカスタムフィールド「custom-more-text」に設定されたテキストに置き換える。(WP2.8以降でないと動作しません)
Author: wokamoto
Version: 0.0.2
Author URI: http://dogmap.jp/

License:
 Released under the GPL license
  http://www.gnu.org/copyleft/gpl.html

  Copyright 2009 wokamoto (email : wokamoto1973@gmail.com)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
function custom_more_text( $output ) {
	$custom_more_text = get_post_meta(get_the_ID(), 'custom-more-text', true);
	if ( !empty($custom_more_text) )
		$output = preg_replace('/(<a [^>]*>)[^<]*(<\/a>)/i', '$1'.$custom_more_text.'$2', $output );
	return $output;
}
add_filter( 'the_content_more_link', 'custom_more_text' );
?>
