Difference between #6 and #7 of
Integrating Wordpress and Yii: still another approach, using Yii as the router/controller

Changes

Title unchanged

Integrating Wordpress and Yii: still another approach, using Yii as the router/controller

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

wordpress, yii, integration

Content changed

[...]
When you're finished following this article, you'll have a website that integrates WordPress and Yii routes in under one path. For example, you can setup /widgets and /customers to point to Yii controllers and /about-us, /contact-us, /blog/* and /faq pointing to WordPress pages.

What we're going to do is place Yii in front of WordPress to act as a router/controller. We'll then load WordPress up partially underneath the hood (enough that Yii can use headers, etc) but not hand off to WordPress unless Yii can't resolve the route. If Yii can't resolve the route, we'll have WordPress act as a custom error handler (for 404s only). Having wrapped Yii around WordPress allows us to use Yii objects / models / databases within WordPress plugins, functions and themes. It's pretty cool!

### GitHub repository
 
The basic setup is available on Github:
 
[https://github.com/acorncom/yii-wordpress-integration](https://github.com/acorncom/yii-wordpress-integration)
 
 
Note: there's a brief ReadMe on Github, but you may want to read on to understand what is going on :-)
 
 
### WordPress setup

The easiest way to set things up is to have WordPress in a separate folder within your webroot folder, so that you don't have to worry about WordPress upgrades overwriting your files (and especially your entry script). Once WordPress is installed and setup to run smoothly out of /wordpress (path is easy to change), make sure the General Settings for WordPress are setup as follows:
[...]
- [Forum post for general discussion](http://www.yiiframework.com/forum/index.php/topic/31212-discussion-off-the-wiki-article-integrating-wordpress-and-yii-still-another-approach-using-yii-as-the-routercontroller/)
- [Github repository](https://github.com/acorncom/yii-wordpress-integration)
 
 
Questions / thoughts / feedback / suggestions? Please post to the forum topic linked above so it's easier for other people to find. Find some bugs / snags in the article? Comments below are gladly welcomed.
19 0
24 followers
Viewed: 86 354 times
Version: 1.1
Category: How-tos
Written by: acorncom
Last updated by: acorncom
Created on: Apr 13, 2012
Last updated: 11 years ago
Update Article

Revisions

View all history