Wordpress code skew

A while back when posterous shut up shop we took edutalk.info and made it a wordpress site. I blogged some of the process EDUtalk Setup – WordPress Tech Notes.

This weekend I’ve been trying to improve the workflow for the live shows we do as part of the site.

Previously we have a page which lists all of the planned shows. This page is just edited by hand, and show information needs to be deleted after the show goes out.

I’ve felt for a while that we should be able to do something better. My idea was as each show was arranged it should be a post which would be published on the Forthcoming page until it was broadcast and recorded, the post would then go to the main page. The problem I for saw was that the posts would be dated when first published and not when the audio was added. The Radio ‘episodes’ would then not fit in with the main flow.

I did a bit of googling1, and found you can:

  • create custom posts types in WordPress which could have extra fields, for example date.
  • sort post by this date field (on the Forthcoming page)
  • publish/show ‘draft’ posts (on the Forthcoming page)

So this is what I did:

  1. Made a custom post type called show
  2. Gave the editor for shows a ‘Meta Box’ with a field for the planned show date.
  3. Added a datepicker with jQuery UI.
  4. Created a schedule page where draft shows are shown sorted in order of the datepicker field

The process of posting is now:

  1. When a broadcast is arranged we create a draft show. This then shows up in the correct order of the Schedule page.
  2. After the broadcast we will add the archived audio to the ‘show’ and publish it, it will then be automatically removed from the Schedule and be posted, with the correct date onto the blog.

What is to Love?

Out the box a wordpress blog is a useful publishing system, it is pretty easy to use. I’ve found when introducing staff to blogs they can use them quickly without much explanation. They usually find it easier to use than editing their school websites.

The next step is to activate some plugin, edit themes and add some widgets, this will enable lots more functionality. For example the FeedWordPress plugin pulls in audioboos tagged edutalk and publishes then on the Edutalk site. The WPBadger plugin allows us to issue open badges.

After that you might need to dig a little deeper and edit the code, this is a lot less scary than it sounds. It looks like wordpress is designed for folk to tweak and edit even if they have no real coding chops. Everything seems to be in its own we compartment and made to be easiy to edit. Experimenting with code in a child theme makes it easy to step back if you get into trouble. There is also a huge community of folk posting information on the web, and the WordPress Codex: the online manual for WordPress and a living repository for WordPress information and documentation..

I had only the vaguest idea of what I was doing to improve our workflow, but a very short time on google sorted it out.

This makes wordpress a very nice platform for developing online spaces, there is not a huge gulf between just using the software ‘out of the box’ and beginning to customise it to your needs.

Glow Blogs

Tomorrow is my last day working in North Lanarkshire before I take a secondment to work with glow. At the moment, thousands of glow blogs exist, running on a fairly old version of wordpress with very little opportunity to do much in the way of customisation. I hope that glow will both continue to supply WordPress blogs and to make them much more powerful. I’ve no idea if I will be in a position to influence this, but this is what I would like:

  • The MextAwebLogAPI to be activated, this allows posting to blogs from mobile applications.
  • More plugins, especially FeedWordPress that would allow a teacher to ‘collect’ their pupils blogs or anyone to create a space were others could easily contribute from their own blog.
  • Access to editing the code, either through the web interface of via ftp (I guess this might be the hardest one to pull off).
  • More themes (there are only about 6 in glow) would not do any harm.

One way to do this, would be for glow to supply web hosting, these spaces, like cheap webhosting all over the internet, could allow one click installs of WordPress (and lots of other software). I explored this in a recent post here: Glow should be at the trailing edge? but have not really got an idea if this is possible from either a cost or execution point of view? I hope to find out soon if this is a possibility or a pipe dream.

A final note, this blog does not run off wordpress but pivotx. Edutalk, ScotEdublogs and my DS106 blog, 106 drop in, are all WordPress.

Code eyes

These are some technical notes on some of the changes I’ve made to the standard WordPress site for EDUtalk, I am not sure if they are of much interest to anyone but myself, but writing them up here will, 1. get them clear in my mind, and 2. provide a reference.

The site is running on WordPress 3.5.1. I made a child theme as I wanted to edit some of files and mostly be upgrade proof.

If you have no interest in this you might be interested in the main facts of the move: EDUtalk Has Moved, or just head over to EDUtalk and listen to some great audio.

Plugins

  1. Akismet, spam protection, pretty much a no brainer.
  2. FeedWordPress, this is very much at the heart of the new site, this plugin allows you to syndicate content from other sites, in our case audioboo boos tagged edutalk and iPadio phlogs with the same tag. Posts form these sites with the tag are added to EDUtalk. The plugin also allows us to make the titles link to the original site rather than our own post page, I believe this is a better way to do things for the authors who submit content by tagging.
  3. MediaElement.js – HTML5 Audio and Video, I installed this initially but it is now turned off. Instead I have used this JavaScript myself. As I understand it the plugin will provide html5 and fallback players for audio inserted with a short code player. As a lot of our content comes via FeedWordPress it would not work there unless we manually edited posts.
  4. In the process of importing all of the old content I found the Categories to Tags Converter Importer and WordPress Importer plugin invaluable.
  5. The Safe Redirect Manager plugin redirects links from the old site to the new one, for example, /pages/radio-edutalk to /listen.

Child Theme Files

It seems that the way you best edit a WordPress theme is through Child Themes, this avoids problems when upgrading.

I started by copying the content.php file from the theme to the child theme folder. Here I edited the php to add an html 5 audio player to the top of a post, if the post had an enclosure. I used:$enclosureData = get_post_meta($post->ID, 'enclosure' ); to find out if there was an enclosure. I had a bit of hassle as Audioboo encloses images as well as mp3s, but looped through the enclosures and used the first audio one I found.

I had to edit the main theme function.php file to comment out a bit of code that removed enclosures if they were not linked in the post. This proved a problem when doing some manual edits of the imports. I got information on how to do this from this post: How to stop WordPress 2.8 – 3.5 from deleting enclosures | Kevin J Edwards. The main tool used in building edutalk.info was google. In this case I edited the theme’s own function.php file, rather than the child themes, as the child theme’s function.php is added to, rather than replacing the parent theme. If there is a better way to do this, I’d like to know.

I did create a child theme function.php and added functions to include the jQuery and MediaElement.js. I then copied the footer.php to the child theme and added a script to added a flash player to the audio tags for browsers that do not play mp3s natively.

jQuery(document).ready(function() {
	jQuery('audio').mediaelementplayer();
});

Pretty simple stuff.

Originally I added a bit more jQuery to hide the audioboo and ipadio players and maps in the post. They were not making the posts look very nice, and I found it difficult to style them. Later on, as I found that the pages were loading very slowly, I went back into the content.php file and added some code to only show the post content, if it was in the Radio Edutalk category. Even with only 6 posts per page this made a huge difference in speeding up the page loading (twice as fast). I changed:

<?php  the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) );  ?>

to

<?php if(in_category(5)){the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) );} ?>

5 being the category for Radio Edutalk, I’ll be adding another category for mailed in audio if needed. Thinking about it it would be best to change to not in the audioboo and ipadio categories.

Screenshotpingdom

Altogether it was not very hard to figure this out with the help of google. WordPress is extremely well documented. The code is also easy to edit, without having to understand the whole thing. There are probably a lot of better ways to do this, and I’d be delighted to find out.

I’d also be interested in any other ways to improve the site, speed it up or add useful features.

Like quite a few folk I’ve been kicking the tyres of Glew a wee bit over the last week or so. One very interesting feature is a plugin that Charlie has preinstalled into the wordPress blogs, FeedWordPress:

FeedWordPress is an Atom/RSS aggregator for WordPress. It syndicates content from feeds that you choose into your WordPress weblog; the content it syndicates appears as a series of special posts in your WordPress posts database. If you syndicate several feeds then you can use WordPress’s posts database and templating engine as the back-end of an aggregation (“planet”) website.

I’ve given this a quick test here: johnj (glew login needed, get one while it is hot!) where I’ve aggregated two of my blogs, my flickr stream and audioboo. The only one that doesn’t work too well is the audioboo one as the plugin does not grab the attachment.

I’ve only given this a quick test, but it seems to work very well. There are lots of options for adding categories or tags to posts from a particular feed too.

This could be used for either collecting things from a variety of publishing platforms to one blog, or perhaps be the holy grail for teacher struggling with the current glows e-portfolios: collecting all of your pupils post in the one place. The current glow solution of this is to have a list of links in glow that the teachers can click on to visit blog. I’ve told as many folk as I can that it is better to save a folder of bookmarks in their browser and open in tabs but this is not ideal.

FeedWordPress will handle a lot of blogs over in DS106 is pulling in over 500 blogs and spitting them out in lots of interesting ways (for example Dynamic OPML Files Generated from FeedWordPress).

For those interested in e-portfolios Glew also has the Mahara ePortfolio System, open source e-portfolio and social networking software built in.

The Sandaig blogs have been running since 2004, it is now time to move to a newer system for the school’s blogging. We have installed wordpress and are going to use that for most of the blogging at Sandaig from now on.

The new blog address is:

http://www.sandaigprimary.co.uk/otters

Where you will find the sort of posts you use to find on the old Sandaig otter’s blog, the poetry blog, Sandaig TV and all the other blogs. The only exceptions are the Head Teacher’s blog, which is staying right were it is: HT News and the Eco blog which will move to http://www.sandaigprimary.co.uk/eco.

If you link to the Sandaig blogs you may like to update your links. The older blogs will stay where they for reference but comments will be closed in the near future.

Wordpressicon

At Sandaig I used pivot as a weblog system. it is a system I like. This blog run on PivotX a complete rewrite of pivot. When I started the Sandaig blogs, I choose pivot mainly on the basis that it uses a flat-file rather than a database for storage (pivotx can use either, I use a database here now as it seems faster) and you could have many subweblogs (we had over 20) running of the one install. Pivot is also an easy system to customise if you know a little html, so I could fit it in with the rest of the site easily (for example the HT News fits in with the rest of the site). Over the years the blogging system grew quite big and complex. We did try a wpmu install for a year, but didn’t use it enough to keep it going. I have been very happy with pivot except for a couple of times the config file has be corrupted and allowed a flood of spam in that required manual deletion. I had another one of these a few weeks ago and spent a Saturday morning deleting spam:(

So I though it was probably time for a change in setup. I could have upgraded all of the Blogs to the new version of pivot, but changing 20 odd themes and setting did not appeal especially as the school will not keep up the same amount of blogging. I decided to move to wordpress as that should be easier to maintain even if I am not involved. I like the fact that you can upgrade wordpress from the admin area of the blog. I also decided to sort of merge the functionality of most of the blogs into one. The excepting being the HT blog which will still be pivot and the eco blog which has been moved to a separate wordpress install. The eco blog only had a few posts so I though it would be simple to import them from pivot, via wordpress’ RSS import.

So I did a couple of wordpress installs and uploaded a couple of themes and messed about a bit. This all was fairly straightforward, I’ve installed wordpress a few times (amd wpmu too) so didn’t hit any major snags.

Importing from RSS gave me more of a headache, when I went to the import screen and choose RSS (or any other format) I got a blank page. I quick google show this has happened elsewhere but I didn’t see a solution i could use. I did a test on a test wordpress blog on this domain and could see the importer page there. So i made another install of wordpress here and imported the eco blogs rss. I then used phpMyAdmin to export the database from the mySQL database. using phpMyAdmin on the Sandaig site I dropped the relevant bits and imported the exported database. It went quite well, there are sill a few things to tidy up and i needed to change some of the urls in the database (as it kept redirecting my logon to this domain.) but all seems well now. I’ve created various class accounts and mailed instruction for use to Sandaig. hopefully they will get their heads round it soon. I believe there is an interesting International project in the works and hope to see that online.

I also hope that the blogs continue to get support for all the folk who commented there over the years, this is a great encouragement to the pupils.

After all the fuss last year testing WP and Lyceum here with pretty poor results, I now have a working wordpress mu setup: Sandaig PupilsI’ve not got any children started, just trying to get the setup ready, so far all I’ve added the Anarchy Media Player and put together a widget to pull the links for the rest of the Sandaig blogs in.
I hope to run this for one of our primary seven classes while the other one uses the pivot blogs set up last year now renamed Primary Seven S

Hopefully I’ll be able to do some comparisons between Pivot and WPMU.

If you have any good wordpress mu tips, please let me know. I am especially interested in being able to set up site wide widgets by default.

Blogged from tm