博客所在服务器升级为php7.0,但是typecho不支持php7.0只好转换为wordpress了,相关友情链接逐步增加中。

转换程序是使用的 http://www.hjwsky.com/network/typecho-to-wordpress.html 这个转换程序(typecho2wordpress.zip)由于不支持直接转换为wordpress对程序进行了小小的修改,(转换程序不支持php7.0,请在5.x下进行)

打开_code.php

修改

/ 查询所有文章 /

/ 查询所有评论 /

之间代码部分为:

/ 查询所有文章 /
$post_sql = "SELECT * FROM {$tp_prefix}contents";
$post_result = mysql_query($post_sql);
while ($row = mysql_fetch_assoc($post_result)) {
if ($row['type'] == "attachment") {
$img = unserialize($row['text']);
$imgarr = array_reverse(explode("/", $img['path']));
for ( $i=0; $i<4; $i++ ) {
$img2[] = $imgarr[$i];
}
$imgpath = implode("/", array_reverse($img2));
$path = $site . "/wp-content/" . $imgpath;

 

$wpdb-&gt;insertRecords($wp_prefix . "posts", array(
'ID' => $row['cid'],
'post_author' => $row['authorId'],
'post_date' => change_date_format($row['created']),
'post_date_gmt' => change_date_format($row['created']),
'post_content' => "",
'post_title' => $row['title'],
'post_status' => $row['status'],
'comment_status' => change_comment_status($row['allowComment']),
'ping_status' => change_ping_status($row['allowPing']),
'post_password' => $row['password'],
'post_name' => $row['slug'],
'post_modified' => change_date_format($row['modified']),
'post_modified_gmt' => change_date_format($row['modified']),
'post_parent' => $row['parent'],
'guid' => $path,
'menu_order' => $row['order'],
'post_type' => $row['type'],
'post_mime_type' => $img['mime'],
'comment_count' => $row['commentsNum'],
'post_excerpt' => '',
'to_ping' =>'',
'pinged' =>'',
'post_content_filtered'=>'',
));
} else if( $row['type'] == "post" || $row['type'] == "page" ) {
$wpdb-&gt;insertRecords($wp_prefix . "posts", array(
'ID' => $row['cid'],
'post_author' => $row['authorId'],
'post_date' => change_date_format($row['created']),
'post_date_gmt' => change_date_format($row['created']),
'post_content' => $row['text'],
'post_title' => $row['title'],
'post_status' => $row['status'],
'comment_status' => change_comment_status($row['allowComment']),
'ping_status' => change_ping_status($row['allowPing']),
'post_password' => $row['password'],
'post_name' => $row['slug'],
'post_modified' => change_date_format($row['modified']),
'post_modified_gmt' => change_date_format($row['modified']),
'post_parent' => $row['parent'],
'menu_order' => $row['order'],
'post_type' => $row['type'],
'comment_count' => $row['commentsNum'],
'post_excerpt' => '',
'to_ping' =>'',
'pinged' =>'',
'post_content_filtered'=>'',
));
}
}
/ 查询所有评论 /