Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何结合/集成CodeIgniter和Wordpress博客功能?_Php_Wordpress_Codeigniter_Integration_Blogs - Fatal编程技术网

Php 如何结合/集成CodeIgniter和Wordpress博客功能?

Php 如何结合/集成CodeIgniter和Wordpress博客功能?,php,wordpress,codeigniter,integration,blogs,Php,Wordpress,Codeigniter,Integration,Blogs,我的网站有写博客的功能要求。我必须使博客看起来像我的网站外观一样 如何将CodeIgniter和Wordpress博客(仅)功能结合起来,使其看起来像是在同一个网站中 我看到了这个问题:。但没有多少线索。似乎有点过火了 为什么不使用Restful服务,比如检索帖子,然后复制css文件(部分)?要执行此操作,需要创建2个文件并修改2个现有函数。一个功能在CodeIgniter中,另一个在Wordpress中 以下是步骤 1.)打开configs/hooks.php文件并创建一个pre_控制器钩子,

我的网站有写博客的功能要求。我必须使博客看起来像我的网站外观一样

如何将CodeIgniter和Wordpress博客(仅)功能结合起来,使其看起来像是在同一个网站中


我看到了这个问题:。但没有多少线索。

似乎有点过火了


为什么不使用Restful服务,比如检索帖子,然后复制css文件(部分)?

要执行此操作,需要创建2个文件并修改2个现有函数。一个功能在CodeIgniter中,另一个在Wordpress中

以下是步骤

1.)打开configs/hooks.php文件并创建一个pre_控制器钩子,如下所示:

$hook['pre_controller'] = array(
    'class'    => '',
    'function' => 'wp_init',
    'filename' => 'wordpress_helper.php',
    'filepath' => 'helpers'
);
2.)在助手目录中创建一个名为“wordpress_helper.php”的新文件,并向其中添加以下代码:

3.)打开wp includes/link-template.php并进行以下编辑:

if ( ! function_exists('site_url'))
{
    function site_url( $path = '', $scheme = null ) {
        return get_site_url( null, $path, $scheme );
    }

}
if ( ! function_exists('site_url'))
{
    function site_url($uri = '', $scheme = null)
    {

        // if we are in wordpress mode, do the wordpress thingy
        if(defined('CIWORDPRESSED') && CIWORDPRESSED){

            return get_site_url( null, $path, $scheme );

        }else{

            $CI =& get_instance();
            return $CI->config->site_url($uri);
        }
    }

}
4.)将url_helper.php从CodeIgniter helper文件夹复制到APPPATH helper文件夹 并进行以下编辑:

if ( ! function_exists('site_url'))
{
    function site_url( $path = '', $scheme = null ) {
        return get_site_url( null, $path, $scheme );
    }

}
if ( ! function_exists('site_url'))
{
    function site_url($uri = '', $scheme = null)
    {

        // if we are in wordpress mode, do the wordpress thingy
        if(defined('CIWORDPRESSED') && CIWORDPRESSED){

            return get_site_url( null, $path, $scheme );

        }else{

            $CI =& get_instance();
            return $CI->config->site_url($uri);
        }
    }

}
上述步骤将允许您根据一些简单的筛选动态加载CI应用程序或WP站点。它还允许您访问WP中的所有CI功能,您可以使用这些功能