There are a number of ways you can contribute back to WordPress. Tom McFarlin also blogged about it recently, and in summary you can:
- Contribute to the Codex documentation.
- Submit a translation.
- Chime in on the support forums.
- Participate in the IRC chats.
- Submit code.
Obviously, the last one interests me the most, as I write code. I mentioned in a previous post that I wanted to contribute some code back to WordPress, to enhance the gallery shortcode. And today, my fellow readers, I finally did what I have been wanting to do for ages - I contributed a patch back to WordPress core!
Steps To Follow
If you want to contribute a new feature, enhancement or bug fix, you can follow these steps that I took:
- Create a login for WordPress.org - if you have plugins on WordPress.org or have ever used the support forums then you already have a login.
- Install a SVN client - I use Tortoise SVN (Windows) but there are Mac equivalents: SmartSVN or Versions or many others.
- Install and Run WordPress locally - using the source from step 3, get a local instance of WordPress running.
- Make your core changes! - make the necessary additions or changes to the core files and test everything is working as expected.
- Create a patch - using Tortoise to make a patch is as simple as right clicking the modified file or folder and choosing TortoiseSVN -> Create Patch.
- Submit a Trac ticket - read up on submitting bugs, and then create a new ticket. Be as descriptive as possible.
- Upload your patch - immediately after submitting your ticket, add your patch file as an attachment.
- Hold on to your pants - now wait to see how your ticket will be received.
I submitted ticket #26623: Make gallery_shortcode more customizable. It’s a small enhancement to the gallery_shortcode function which outputs the HTML for the built-in galleries. I included some code to make it easier to style and also makes it much easier to override from plugins and themes. I went a bit overboard with my ticket and gave a huge explanation including code samples. I also pointed to a Github repo where I have committed a demo plugin which used the newly proposed changes.
Support My Ticket
If you have worked with the gallery at all, then you will understand why I submitted this ticket. It is simply too hard to customize the default gallery at this point in time. Making any changes means you have to override the entire function, including all of it’s logic. My goal with this patch, is to keep this logic in place and hidden, while still allowing for complete customization of the HTML code. Plugin and theme authors should love this change!