Recently at WordCamp Melbourne, Ryan McCue said the following to all attendees:
If everyone simply contributed just one thing to the WordPress project, then WordPress would be infinitely better.
Please pause, and think about that for a second.
Going back a few years, there seemed to be a heavy focus on core code being the primary way to contribute to the WordPress open source project.
However in recent times, I’ve noticed a lot of effort has been put into helping the community contribute to the project in other ways (such as documentation, events, or support).
The WordPress Foundation has recently posted a great summary on how you can get involved in the WordPress project.
Regardless of whether you’re using WordPress for business or personal reasons, I strongly suggest you have a read of the article, which lists these teams/areas that you can get involved in:
- Core (testing, bug reporting, code wrangling)
- Events (WordCamps, meetups, etc)
- Meta (wordpress.org)
- Mobile ((iOS, Android, Windows Phone, and BlackBerry apps)
- Polygots (translations)
- UI (user interface design & development)
- Updates (news / blog posts)
In my case, so far I have helped out with WordPress core (bug reporting & fixing), documentation, events, plugins, suport and updates.
However I haven’t been contributing as much as I would like to. I’ve only used six of the thirteen ways that I could be contributing, so there’s definitely still room for improvement!
How are you planning on contributing to the WordPress project?
Although WordPress themes typically use Responsive Web Design to tailor website for mobile devices, there is sometimes a need to use PHP (backend code) to detect whether the visitor’s web browser is running on a mobile device.
For example, there may be scenarios where you may want to output certain HTML markup (such as a mobile navigation menu) on mobile devices.
Alternatively, you may only want to output a slider containing large images on desktop and not mobile devices. Doing this via PHP (instead of CSS) means that the visitor’s mobile browser won’t have to download all of the slider images even though the slider is never displayed.
WordPress’ wp_is_mobile() function to the rescue!
wp_is_mobile() is a litte-known function built into WordPress that detects whether the visitor is using a mobile devices such as iPhone, iPad, Android, Silk, Kindle, BlackBerry, Opera Mini, and Opera Mobi.
The function was introduced in WordPress 3.4, and it can be used in a WordPress plugin or theme.
It’s a simple function that accepts no parameters, and returns a simple boolean (true/false) value.
Here’s a simple example:
Interestingly, WordPress core currently uses this function in a few different places:
- To completely disable the Visual Editor for Opera Mini.
- To enable jQuery UI Touch Punch in the WordPress dashboard for mobile devices.
- To detect whether the current device can upload files.
- To disable the “shake” effect on the WordPress login page when an incorrect username or password is entered using a mobile device.
Are you currently using the
wp_is_mobile() function in your plugin or theme? If so, I’d love to hear what your use-case is.