Tag Archives: WordPress

Themes, Users And The WP REST API

WordPress Opinion 5 Comments

There is mounting excitement over the WP REST API being added to core and rightly so! It is going to fundamentally change the WordPress landscape and open up all sorts of new possibilities. Developers are drooling over all the cool stuff they are going to be able to build. Exciting times!


When it comes to using the REST API with themes, it may not always be the best choice.

Continue reading

Stop Category Pages From Showing No Results Message

WordPress Development 2 Comments

If you have a category page which has no posts, it will normally trigger your theme’s no posts found message. Seems sensible! However, I have an edge case where I don’t want that message displayed.
Continue reading

How To Prevent Category Widget From Using Category Description As Title Attribute

The Categories widget in WordPress uses the category description as the title attribute for the list items displayed by the widget. While this may be great for very short descriptions, it doesn’t make sense when longer descriptions are in use.
Continue reading

How To Create A Silo Structure In WordPress

| Created: October 26th, 2012
WordPress SEO 74 Comments

Image showing silos and the title "How to create a silo structure in WordPress" Siloing is an SEO technique that creates strong keyword related themes on your site, improving the relevancy of your site in the eyes of the search engines. In this article, I cover the basics of the silo model and then show you how to implement siloing in WordPress.
Continue reading

WordPress And Government

| Created: February 24th, 2012
WordPress and Government 3 Comments
Update (August 2013):
Sadly, the vast majority of issues outlined below are still relevant in July 2013.

Some of the issues I mention below, such as update frequency and automatic updates, have been topics of recent discussion in the WordPress community, following Matt Mullenweg’s announcement in his State of the Word 2013 talk that we’re moving toward more frequent updates.

This has provoked further discussion in the community about the impact of this on the enterprise, most notably in Chris Lema’s Developing WordPress for the Enterprise article.

Having said that, today I learnt of one state government department here, which has gone with WordPress for 3 of their sites. None are huge, but it’s encouraging to hear!

This article extends my presentation, titled “WordPress and Government – the Australian Perspective”, originally given at WordCamp Gold Coast on Sunday 6 November, 2011.

You can view the video of my talk and download the slides on my WordCamp Gold Coast 2011 – WordPress in Government post. I won’t include the video here because things have moved on in the time since I gave the talk.
Continue reading

WordCamp Gold Coast 2011 – WordPress in Government

| Created: February 15th, 2012
WordPress and Government No Comments

I gave a talk titled “WordPress and Government – the Australian Perspective” at WordCamp GoldCoast on Sunday 6 November, 2011.

Here is the video of my talk, via WordCamp TV.

Continue reading

WordPress Optimization Myth: Saving Database Calls

WordPress Development 6 Comments

Tonight I read an article on WPTuts+ titled 10 Quick Tips: Optimizing & Speeding Up Your WordPress Site. For the most part it’s a good article with lots of great tips, but there is one tip which is just plain incorrect:

Using a constant instead of get_option('home'); saves a database call.
Continue reading

Fetch_feed Not Working With URLs Containing & Symbol

| Created: November 30th, 2011
WordPress Development 5 Comments

I recently came across a strange problem with the fetch_feed function in WordPress not working with URLs containing the & symbol. The URL was being passed to fetch_feed via a shortcode parameter, but fetch_feed couldn’t find the feed.
Continue reading

Clearing The Cache When A Widget Is Saved

| Created: November 30th, 2011
WordPress Development 6 Comments

WP Super Cache has a setting which allows the cache to be cleared when a post is saved. I needed to clear the cache when a widget is saved. It turned out to be surprisingly easy.
Continue reading

wordpress.tv Download Link Script

Scripts No Comments

I’ve been watching a lot of videos from WordPress TV lately. There is some absolutely cracking content on there! However, I really wanted to be able to download videos. There wasn’t a download link, so I wrote this Greasemonkey script to add one.


This script can be downloaded from Userscripts.org

Why Download Vidoes From WordPress.tv?

I mostly consume WordPress.tv content from my Android phone.

I don’t want to watch it over my 3G connection. These videos are often 400MB! It seems there’s a lower bandwidth version when you visit on a mobile device, but it’s still around 80MB in the one I did test. That’s still going to chew through my data plan far too quickly.

Sure, I could watch when connected via WiFi, but these videos are long enough that I may want to stop halfway through and pick it up later (when I may be on my 3G connection). If I leave the page open, then the video should play without needing to download anything later – but that’s a big if. Having the raw mp4 file on my SD card gives me more flexibility.

Also, although there are some basic controls built into the player (pause, move around the timeline), it doesn’t compare with the native player on my phone. It can even be viewed in full screen, but it’s fiddly to activate that control.

So all in all, it’s more convenient to be able to download the video file and have it on my device, rather than watch it through the website.

The Code

As with most of my Greasemonkey Scripts, I’ve embedded jQuery in it. This makes it so much quicker to write. It ends up being only a few lines:

        // add contents of noscript into the HTML so we can access it via the DOM, hide it, then extract the URL and add Download link
        $('noscript').before('<div style="display:none" id="wp-tv-download">'+$('noscript').eq(0).text()+'</div>');
        var url = $('div#wp-tv-download a').attr('href');
        $('div#wpl-likebox').after('<div style="text-align:left !important" class="sd-block"><h3 class="sd-title">Download:</h3><div class="sd-content"><a href="'+url+'">'+url+'</a></div></div>');

Line 3: We grab the contents of the noscript element, which includes the download link, and add it in a hidden div before the noscript element. We have to do this so we can manipulate the content of the noscript element, as we can’t access it via the DOM.

Line 4: We then extract the URL from the hidden div we created (which is now in the DOM) and store it in a variable.

Line 5: We then add the download link after the #wpl-likebox div. Note that we use the wordpress.tv classes, such as sd-block, sd-title and sd-content, which makes the result look like the rest of the site.


This script is dual licensed under the MIT and GPL licenses.