wordpress修改汇总

来源:互联网 发布:淘宝助理上传不了宝贝 编辑:程序博客网 时间:2024/05/21 02:21
一、wordpress原文件修改
以wordpress为根目录
1.wordpress/wp-includes/post-template.php
添加如下代码
/*image data for each project*/
function get_the_picdata() {
$post = get_post();
return ! empty( $post ) ? $post->post_picdata : false;
}
function the_picdata() {
echo get_the_picdata();
}

/*project data for each project*/
function the_projectdata() {
echo  get_the_projectdata();
}

function get_the_projectdata() {
$post =  get_post();
return ! empty ( $post ) ? $post->post_projectdata : false;
}
/*The post_flag of post is used to judge whether it is a project*/
function the_flag()
{
echo  get_the_flag();
}
function get_the_flag() {
$post =  get_post();
return ! empty ( $post ) ? $post->post_flag : false;
}
注意:echo方式没有返回值。
2.启用BUddyPress、BuddyPress Like、BP Groupblog、Custom Meta Widget插件
3.采用buddypress默认主题bp-default
(1)在wordpress/wp-content/themes/bpdefault/index.php和single.php添加如下代码
<?php if(get_the_flag() ==1):?>     
<form action="snap/snapProject.php" method="post" name="projectform" >
<input type="hidden" name="projectdata" value="<?php echo htmlspecialchars(get_the_projectdata()); ?>" />  
<input type="submit" name="submit" value="" title="Click to see the project!"  style="width:480px;height:360px;font-size:20px; background-image:url(<?php the_picdata();?>);" />
</form>
<?php endif;?>
(2)添加snap.php作为模板
4.数据库
(1)修改wp_posts表
①添加post_picdata 类型longtext    存储工程图像
②添加post_projectdata 类型longtext 存储工程数据
③添加post_flag 类型int 默认值0  用来区分普通文章与工程,工程值为1,其他为0
④修改post_status默认值为unpublish
(2)wp_posts、wp_bp_activity、wp_bp_activity_meta具有相关关系
当对wp_posts修改时需要对其他表也要做相应修改才能有提示信息
二、当更换域名或IP地址可能需要修改的地方
1.wordpress/snap/cloud.js
var SnapCloud = new Cloud(
    'http://play.dslab.cn/snapserver/'                                /***********************************/
);
2.wordpress/snap/gui.js
(1)this.logo.texture = '/snap/home.png';
(2)IDE_Morph.prototype.snapMenu = function ()
 {
location.href="http://play.dslab.cn/";          //重定向地址
     menu.popup(world, this.logo.bottomLeft());
};
三、更换数据库可能需要修改的地方
1.connectmysql.php
<?php
$con = mysql_connect("localhost","root","nopasswd");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("project", $con);
$datatable="wp_posts";
?>
四、其他
1.时间
北京时间 为UTC+8
0 0