We are testing the potential to use WordPress as a simple method for mobile information input and management across distributed devices (see cratos.open.ac.uk/wordpress ). Whilst we have previously used Drupal for this purpose, WordPress is easy to set up and use, and requires less development time to do the basics. It also has a lot of plugins available to do things that might be useful as we expand the activities the OTIH system is used in.
It is therefore important to explore approaches to get the content out of a WordPress blog, in order to use it in other applications (e.g. in a C# & WPF application for the Microsoft Surface). There are WordPress APIs, which include functionality for things such as HTTP requests for data. However, one easy option, given that we the server hosting the WordPress site is on the same network as the Surface, is to run MySQL queries directly to the database hosting the blog. This page gives an overview of the database structure installed with WordPress.
The database itself is simply called ‘wordpress’. Two tables are particularly interesting here, the first is ‘wp_posts’, which holds details of each blog post. Secondly, ‘wp_postmeta‘ holds additional fields for each post, so for example, a location attached to a post can be read from here, based on that posts’ ID from wp_posts.
The wp_posts table contains the title and content of each blog post, along with various other data such as date modified and number of comments on the post. The content of comments themselves can be taken from the ‘wp_comments’ table. If we decide to use this further then it looks like comments for a relevant post could be gathered and displayed easily.
Below is an example of what can now be achieved, by combining this with mysqlconnector/net to access the mysql tables directly from c# code on the Surface: