ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Wordpress data into website based on CodeIgniter

December 06, 2012 6:12am

Subscribe [2]
  • #1 / Dec 06, 2012 6:12am

    Leo78

    14 posts

    Hey,

    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’.

  • #2 / Dec 06, 2012 8:57am

    pickupman

    1317 posts

    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.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases