Posts by Adam Pope

Find out more about Adam.

Is Google indexing pages from Twitter and messing with your analytics?

I just Googled for “WordPress RC” to find the release notes for the 3.5 Release Candidate.  I clicked on the result for wordpress.org and was taken to the correct page, nothing out of the ordinary.  I then copied the URL to share in team chat and noticed that the URL was quite long; there were some query string parameters.  The complete URL was:

http://wordpress.org/news/2012/11/wordpress-3-5-release-candidate/?utm_source=twitterfeed&utm_medium=twitter

The utm_source and utm_medium parameters are used by Google Analytics to segment traffic by source.  Normally you would expect to end up on this URL if you clicked from the WordPress Twitter feed.


Continue reading

Debugging :active, :focus, :hover and :visited states in Chrome

When you interact with an element on a web page, various pseudo classes are applied dynamically that you can use in CSS to define styles. These changes are not reflected in the Chrome inspector in real-time – you can’t select an element, hover over it and see the :hover styles.  In the simple case of changing text colour of an <a> this isn’t a big problem.  However, as soon as you start to use these pseudo classes for more complex purposes, like building complex navigation menus, you hit a point where you really want to be able to inspect those styles.


Continue reading

Turbo-charging your WordPress site with Turbolinks

At Storm, we use a variety of tools, frameworks and programming languages - we’re committed to being polyglot programmers and to using the right tool for the job!  This gives us a broad view on the world and lets us see what different groups of people are up to.  We’ve been watching the development of Rails 4.0 with interest and one feature in particular has caught our eye: Turbolinks.


Continue reading

Working towards a better TinyMCE editor in WordPress

The editor in WordPress is generally pretty good, but there are some things that have been bugging us, so we’ve fixed them!

By default there is no button to create a table of data in your post or page.  Many of the plugins that enable this feature add in a whole new toolbar with a load of extra buttons. We dont like mess, so our plugin provides the table options in a single button.

As people that don’t like mess, the number of unused buttons in the toolbar also bugs us – it’s also confusing for clients who are new to editing content online.  We also dislike that our clients can add <h1> tags in the middle of content pages.  We’ve corrected both of these issues with a little plugin that lets you customise the options available.


Continue reading

WordPress: Force Lowercase URLs

We’re currently migrating a website which has some URLs with uppercase letters to WordPress.  WordPress slugs are always lowercase.  We are creating identical URLs, but the case will be different.  This will result in a bunch of 404 errors for anybody linking to a capitalised version of a page.

We could just setup a 301 redirection for each uppercase url to the lowercase version, but that would be tedious.  Instead we’ve created a little WordPress plugin that checks if the URL contains uppercase letters and performs a 301 redirection to the lowercase URL.

Go get WordPress: Force Lowercase URLs on GitHub now!

 

jQuery document ready events and TurboLinks

Rails 4 will be shipping with TurboLinks enabled by default.  TurboLinks is a PJAX like library that asynchronously requests the content of the next page and inserts it into the current page’s body instead of requiring a full page reload.   It speeds up page load times nicely.  However, because the page is reloaded, the DOMContentLoaded event is triggered and your jQuery document.ready event wont be triggered.

The Solution

var do_on_load = function() { 
  // do some things 
}
$(document).ready(do_on_load)
$(window).bind('page:change', do_on_load)

You have to listen for the page:change event and bind your function to that too.  Simple.