In a few recent projects we’ve used the excellent WordPress admin for content entry, but built the public facing stuff in CodeIgniter. Making these platforms talk to each other is fairly simple, and this is what we’ve learnt along the way.
- Do not, ever, initialize WordPress to fetch the data.
WordPress is quite the memory hog (compared to CI) and requesting WordPress content via feeds (using the JSON API plugin or such) heavily will bring your server down under load.
- Instead, always query the DB directly.
WordPress data structure is quite simple. But some of the WordPress functions are poorly written, so port them manually rather than just dumping them into CI.
As we’ve used this on a few sites already, it felt like we should wrap this into something generic and reusable. And with Sparks making its way into the CodeIgniter core, the time had come to learn how to wrap reusable CI stuff in sparks. So here we go. Version 0.0.4 of CodeIgniter-WP. There are only a few methods available at the moment, but hey – look at the version number. It will be better.
$this->load->spark('wp/0.0.4');
print_r($this->wp->get_post('blog', 1);
print_r($this->wp->get_installations());
print_r($this->wp->wp_get_recent_posts('blog', array()));
print_r($this->wp->get_post('blog', 1));
print_r($this->wp->get_post_meta('blog', array('post_id' => 1, 'key' => '_edit_last', 'single' => false)));
Download the spark by following the instructions here.
Our first released WP plugin – EP Comments Export
2012-01-05 10:46:17WordPress is a system we have been using a lot , since years back. Today, for the first time, we release a plugin to the WordPress plugin directory.
The plugin, with the name EP Comments Export, lets you easily export all comments and comment meta data from a specific post, page or custom post type. The export will be saved as a .csv file for you to download. To download the .csv file, just click the new icon added in the all posts/page list.
Today you can only export comments. There are plans on making it possible to import an exported .csv file to a post.
You find more information and the plugin at wordpress.org plugin directory.
Tags: comments, csv, export, export comments, plugin, Wordpress, wordpress.org, wp, wp plugin | Wordpress