0

我有一个 Wordpress 安装,比如在 localhost/blog/ 路径中。

我还在根文件夹中安装了另一个自定义 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 功能受到影响?

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

提前致谢。

4

0 回答 0