CodeIgniter Forums
embedding wordpress in CI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: embedding wordpress in CI (/showthread.php?tid=8149)

Pages: 1 2


embedding wordpress in CI - El Forum - 05-07-2008

[eluser]AtlantixMedia[/eluser]
Hello,

first of all, can anyone take a look at this?

http://www.welovelocal.com/blog/2008/05/

that is a wordpress blog embedded in their custom application or cms. can something similar be achieved with CI? I basically want wordpress functionality and CI at the same time, like showing a common header and footer.

thanks


embedding wordpress in CI - El Forum - 05-07-2008

[eluser]Gavin Blair[/eluser]
I've created a series of models that pull things in from a wordpress database (2.2 or older for now). This allowed me to create a blog frontend that is less restrictive than a wordpress theme. For example, I can pull categories out individually, and format them in any way I want, whereas wordpress only allows me to put them into an unordered list.

So, I use wordpress as a backend, to write posts, etc. and I use my CI as a theme. To do this, my directory structure looks like this:

index.php (CI)
/wp-admin (WP)
/system (CI)
/js
/wp-content (WP)
/wp-includes (WP)
...

Is this what you mean?


embedding wordpress in CI - El Forum - 05-07-2008

[eluser]AtlantixMedia[/eluser]
yes.

1) why not have all wp folders inside a main blog folder?
2) if you use wp strictly as a blog back-end, you basically have to rebuild wp url structure from scratch?
3) what about enabling comments? how do you handle that?

thanks


embedding wordpress in CI - El Forum - 05-07-2008

[eluser]Gavin Blair[/eluser]
1) The only reason I didn't put WP in its own folder is because I want to go to mydomain.com/wp-admin to log into the backend.

2) I just use Code Igniter's url structure. So, the url for a particular post is mydomain.com/index.php/posts/post-slug. It uses my Posts controller, and passes the nicename of the post as an argument. It then goes to my nifty Posts Model which pulls in the entire post from the WP DB. Of course, I can get rid of 'index.php' by modding my .htaccess file.

3) I haven't written the comments part yet, but I imagine it would be the same as posts. I just create a Comments Model that contains functions to get comments for particular posts, and apply comments to particular posts ( Comments_Model->CreateComment($commenttext, $email, $url, $postID) ).

Once I'm done the models I'll post them so that anyone can create more flexible Wordpress Themes based on Code Igniter.


embedding wordpress in CI - El Forum - 05-07-2008

[eluser]AtlantixMedia[/eluser]
thanks for the info.

can't you just do www.mydomain.com/blog/wp-admin? just trying to understand.

so you are basically using wp as a blog back-end and CI to query for raw data which you then present anyway you like.


embedding wordpress in CI - El Forum - 05-07-2008

[eluser]Gavin Blair[/eluser]
I can do that. In fact, in another site I have, I have wordpress installed in /backend/ and I have a /backend/index.html that redirects to /backend/wp-admin.

Yes, that's exactly what I'm doing.


embedding wordpress in CI - El Forum - 05-08-2008

[eluser]Grahack[/eluser]
Hi, you can try to use some CI code inside other apps. Have a look here.


embedding wordpress in CI - El Forum - 06-27-2008

[eluser]whidbey[/eluser]
[quote author="Gavin Blair" date="1210192441"]1) The only reason I didn't put WP in its own folder is because I want to go to mydomain.com/wp-admin to log into the backend.

2) I just use Code Igniter's url structure. So, the url for a particular post is mydomain.com/index.php/posts/post-slug. It uses my Posts controller, and passes the nicename of the post as an argument. It then goes to my nifty Posts Model which pulls in the entire post from the WP DB. Of course, I can get rid of 'index.php' by modding my .htaccess file.

3) I haven't written the comments part yet, but I imagine it would be the same as posts. I just create a Comments Model that contains functions to get comments for particular posts, and apply comments to particular posts ( Comments_Model->CreateComment($commenttext, $email, $url, $postID) ).

Once I'm done the models I'll post them so that anyone can create more flexible Wordpress Themes based on Code Igniter.[/quote]


have you compliete it?thx


embedding wordpress in CI - El Forum - 06-27-2008

[eluser]Dave Stewart[/eluser]
This is very cool.

I f-ing hate Wordpress codebase with a passion - even though I still bloody use it! It's just so clumsy and undocumented, so this is a great idea.

Cheers,
Dave


embedding wordpress in CI - El Forum - 06-27-2008

[eluser]Jamie Rumbelow[/eluser]
I would recommend InkType. It's a great blogging system built directly in CodeIgniter.