今天把wordpress的post-template.php修改了

为的是把amazon的资料采集到wordpress时发生的摘要令到wordpress的模板错位, 自己记录下, 因为自己还不会编写wordpress的插件,所以先直接改源代码.

位置, wp-includes目录下,

修改内容在post-template.php的129行,改成:


function get_the_content($more_link_text = ‘(more…)’, $stripteaser = 0, $more_file = ”) {
global $id, $post, $more, $page, $pages, $multipage, $preview, $pagenow;

$output = ”;

if ( !empty($post->post_password) ) { // if there’s a password
if ( !isset($_COOKIE[‘wp-postpass_’.COOKIEHASH]) || stripslashes($_COOKIE[‘wp-postpass_’.COOKIEHASH]) != $post->post_password ) {    // and it doesn’t match the cookie
$output = get_the_password_form();
return $output;
}
}

if ( $more_file != ” )
$file = $more_file;
else
$file = $pagenow; //$_SERVER[‘PHP_SELF’];

if ( $page > count($pages) ) // if the requested page doesn’t exist
$page = count($pages); // give them the highest numbered page that DOES exist

$content = $pages[$page-1];

if ( preg_match(‘/<!–more(.*?)?–>/’, $content, $matches) ) {

$content = explode($matches[0], $content, 2);
if ( !empty($matches[1]) && !empty($more_link_text) )
$more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
} else {
$content = array($content);
}
if ( (false !== strpos($post->post_content, ‘<!–noteaser–>’) && ((!$multipage) || ($page==1))) )
$stripteaser = 1;
$teaser = $content[0];
if ( ($more) && ($stripteaser) )
$teaser = ”;
$output .= $teaser;
if ( count($content) > 1 ) {
if ( $more ) {
$output .= ‘<span id=”more-‘.$id.'”></span>’.$content[1];
} else {
$output = balanceTags($output);
if ( ! empty($more_link_text) )
$output .= ‘ <a href=”‘. get_permalink() . “#more-$id\” class=\”more-link\”>$more_link_text</a>”;

//2008.7.4 18:24 my edit
$output=str_replace(“<!–amazon–>”,”</div>”,$output);
}

}
if ( $preview ) // preview fix for javascript bug with foreign languages
$output =    preg_replace(‘/\%u([0-9A-F]{4,4})/e’,    “‘&#’.base_convert(‘\\1′,16,10).’;'”, $output);

return $output;

关于无聊人

一个无聊人而已
此条目发表在php分类目录。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用*标注