如何将 WordPress 模板与 CodeIgniter 集成 [英] How to integrate WordPress template with CodeIgniter
问题描述
如何将 CodeIgniter 和 WordPress 集成在一起,使得WordPress 博客会转移到 CodeIgniter 创建的页面吗?
How can CodeIgniter and WordPress be integrated such that the look and feel/template of the WordPress blog is carried over to the CodeIgniter-created pages?
推荐答案
第一步是将 CodeIgniter 和 WordPress 文件移动到它们自己的目录中.
First step is to move CodeIgniter and the WordPress files in their own directory.
之后,将以下行放在 CodeIgniter 的 index.php
文件的顶部.根据需要将路径更改为 wp-blog-header.php
以指向 WordPress 的根目录.
After that, put the following line at the top of your CodeIgniter's index.php
file. Change the path to wp-blog-header.php
as needed to point to your WordPress's root directory.
<?php
require('../wp-blog-header.php');
然后,您可以在视图中使用以下函数:
Then, you can use the following functions inside your views:
<?php
get_header();
get_sidebar();
get_footer();
?>
其他辅助函数也可以在 WordPress 的文档中找到协助您整合设计.
Other helper functions can also be found in WordPress's documentation which can assist you in integrating the design.
这篇关于如何将 WordPress 模板与 CodeIgniter 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!