Welcome Guest, Not a member yet? Register   Sign In
Wordpress data into website based on CodeIgniter


I have a website based on CodeIgniter and external WordPress blog (but the website and the blog are hosted in the same database).
In my website I would like to display some recent posts, favorite posts and etc (the meaning is just take data from the WordPress blog).

There is a WordPress library for CodeIgniter? or should I need to build a library from scratch and simply retrieve data from the database manually without using the API of the WordPress? Is it good idea to build a library (or at the other words: API for my needs)?

Thank you very much.

EDIT: oops, I published at the wrong forum, please move this topic to 'Development & Programming'.

Since they are hosted in the same database, you should write a simple model that get posts/pages from the database. You can load the Wordpress bootstrapper, and access the native functions like get_posts(), but probably not worth the overhead. Another option is to use a JSON plugin. That allows simple access to call a url and get a json string of posts. Then parse the JSON. I have used both methods, the latter when they are in different databases. Either option, you can cache the results to speed up the page.

Theme © iAndrew 2016 - Forum software by © MyBB