我有一个Wordpress安装,比如在localhost / blog / path中 .

我还在root文件夹中安装了另一个自定义CMS,如localhost / .

我想将我的CMS'MySQL类包含在博客的安装中,所以在博客主题的header.php中,我包含如下:

<?php
global $site_config, $_db // $_db is my CMS' equivalent to $wpdb;

include_once("../includes/class.query.php");
?>

我可以在Wordpress博客中访问我的CMS'数据库 .

但是,像文章作者那样的Wordpress中的一些变量却丢失了 . 调用诸如“get_the_author_meta('ID')”,“the_post_thumbnail('thumbnail')”之类的函数返回空字符串 . 此外,在帖子中发布的帖子也不见了 . 其他内容,如帖子内容工作正常 .

上面'class.query.php'的内容相当简单 . 我把它缩小到这几行:

function connect()
{
    if ($this->mysql_link = @mysql_connect($this->dbhost, $this->dbuser, $this->dbpass))
    {
        if (!mysql_select_db($this->dbase))  // <---- this is the line that screwed up the integration
        {
....

我想知道是否有人知道这里发生了什么 . 为什么只有一些Wordpress功能受到影响?

我怎样才能解决这个问题?

提前致谢 .