Week Beginning 4th May 2015

It was a four-day week this week due to the May day holiday. I primarily split these four days between two projects: Essentials of Old English and the Scottish Thesaurus project. Last week I had completed a first version of the ‘app’ version of EOE and had begun work on the ‘web’ version. This week I managed to complete the ‘web’ version too, which can currently be found here:


As mentioned last week, migrating all of the pages and exercises to the University’s page layout presents some difficulties due to having to switch from the JqueryMobile library to something else (in this case a mixture of the University’s existing interface elements and some custom Jquery UI components that I created). Having said that, getting the content to work wasn’t overly tricky as I had already formatted everything for the ‘app’ version in such a way that it would not need to be recoded for use elsewhere. The book content and the exercise content could for the most part simply be ‘plugged in’ to the new interface.

After completing the ‘web’ version I emailed the URL to various people for feedback and Christian got back to me with a list of things that needed looked into. A few of these things were typos and other easy to correct problems, but she also encountered a number of major issues with the exercises. Rather strangely, I was unable to replicate these issues on my own PC, even when trying with a variety of web browsers. After some investigation I realised the issue was being caused by Christian’s work PC still having Internet Explorer version 8 running on it. This version is now very out of date and Microsoft is ending all support for it in January 2016 and I don’t think it’s worth spending time developing a version of the app that works with this browser. Christian asked IT Support to update her PC and everything seems to be ok now.

I spent the rest of the week on Scottish Thesaurus duties. I met with Susan and Magda last week and Susan stated that she would like to be able to demonstrate a front end for the thesaurus at a conference in August. What she wants for the project is a thesaurus that people can search and browse both textually and visually, but also interact with by means of posting comments, images and media clips to thesaurus categories. We decided that the best way to manage any user submitted content would be via WordPress, which means integrating the thesaurus front end with the WordPress interface.

I’ve been meaning to look into developing WordPress plugins for a while now and this seemed like a good opportunity to get to grips with the development of such things, so I spent some time this week researching how to create plugins, or other possible ways of integrating with WordPress.

It turns out that WordPress plugins are pretty easy to set up and mostly consist of your own PHP code plus a number of ‘hooks’ to get what you are doing integrated with the WordPress system and its underlying database. Initially I wanted to keep WordPress and the thesaurus data completely separate and set up a plugin that would allow browsing through the thesaurus database via one page by means of a WordPress shortcode (see http://www.smashingmagazine.com/2012/05/01/wordpress-shortcodes-complete-guide/). I got this to work fairly quickly, with the shortcode on a page resulting in a query to the thesaurus database I’d set up and the display of the appropriate data within a WordPress page. Unfortunately I hit a snag: As far as WordPress was concerned all of the data was being displayed on one single page – my plugin may have been displaying data for a specific thesaurus category but when it came to commenting on the content, WordPress’s commenting system didn’t consider the data displays to be separate pages. Instead, all comments appeared on the data page no matter what data was being displayed.

I realised that I would have to integrate the thesaurus a little more closely with WordPress (well, either that or I’d have to rewrite the WordPress commenting system but that didn’t seem wise). What I decided to develop was a custom post type. This approach means that in addition to standard post types (e.g. ‘blog’, ‘page’), you can create a new type for your data and wordflows. You can create new tables for your data and include new ways of listing or processing the data.

I followed this tutorial: http://blog.teamtreehouse.com/create-your-first-wordpress-custom-post-type and created a type called ‘thesaurus category’. In addition to the standard WordPress information (e.g. title, content) I created a new database table to hold thesaurus specific information (thesaurus category numbers, part of speech, subcategory etc). I could then update the admin interface to provide the necessary boxes for the adding and editing of this information and I could update the ‘list’ view to feature my custom columns too. I could also make my new type appear in the WordPress admin interface as its own left-hand menu item to make it easier for people to manage content.

It took rather longer to get all of this working than the above might suggest, but it was hugely satisfying to see the admin interface updated to enable the management of thesaurus categories. Once this was set up I created a script that migrated the Scottish Thesaurus category data that I previously had access to into my new WordPress integrated table and after running the script the thesaurus data appeared within WordPress and could be edited.

After that I began to look at the front end. I wanted to display the thesaurus data in the front end by means of the handy WordPress shortcodes, but rather than having to add these to the content of each category I figured out how to add them to a template file for my thesaurus category content type. This template file appears within the WordPress ‘theme’ files for the theme that is currently active so we’ll have to watch out if we switch themes. But by adding some simple PHP, such as <?php echo(“<p>”.do_shortcode(‘[thesaurus-browse-up]’).”</p>”); ?> I could access functions in my plugin script, allowing me to handle all of the browsing between thesaurus categories, the display of subcategories and things like that. I’m still in the middle of implementing this at the moment so there is still lots to do (I also haven’t done anything about the words within categories yet either) but it looks like it will be possible to do everything we hoped to be able to do for the thesaurus through the WordPress interface (for example it is now possible to post comments on a specific category).

I will continue with this next week.