A Look at Related Posts by Barry Kooij

I work over at WooThemes with a guy called Barry Kooij. He’s one of those mysterious developers behind WooCommerce, who normally hides in the shadows of WordPress-land creating awesome stuff that you’ve probably even used and loved, like What the File and Post Connector.

To be fair, when Barry started at WooThemes, I’d already been there for a month, so I was feeling pretty settled in. Naturally, I was nice enough to the new Dutch guy but didn’t give him much notice. After all, both our names started with B, so there’s was always going to be some conflict. But when I discovered he had made What the File, a simple plugin that I’d been using for a while and loved, I opened up my heart to him.

Continue reading

Change the WooCommerce Auto Generated Password

In WooCommerce, there’s a setting under WooCommerce > Settings > Accounts to automatically generate a customer’s password. This way user’s only have to enter an email when they register (with the password generated and sent to their email address), similar to how WordPress handles registration by default.

WooCommerce uses WordPress’ core wp_generate_password() function to generate the password, but you may want to change this.

You can do this by filtering woocommerce_new_customer_data, declared around line 102 of woocommerce/includes/wc-customer-functions.php:

So, if for example you wanted to make the password generate as the user’s email, you could use the following:

Or perhaps you want to use the wp_generate_password() function but customise it a little bit, so that it’s only 6 characters and uses all special characters. Something like this would work:

If it helps you out or you were able to customise and make something even more awesome, let me know!

Check if Another WordPress Plugin is Active

Recently I’ve been spending a lot of time working on my new plugin Recipe Hero. Essentially, the plugin is an open-source, free item, but the extensions that I (and others) make for it, can be either free or premium.

Similar to WooCommerce, Easy Digital Downloads, WP Job Manager and even WordPress itself, the core item itself is a simple, sufficient plugin, but the functionality to take it that little bit further and do something ‘out of the norm’, should be in its own separate ‘extension’ or ‘add-on’.

However, what if a user doesn’t realise that and tries to add an extension without the ‘core’ plugin? Or how about when a user deactivates the core plugin but forgets about deactivating the extensions. We need to put a check in for that or you’re going to be dealing with some angry users.

WooCommerce actually has a great article on Creating a plugin for WooCommerce, that gives it a great example of how to check for another plugin. A lot of people like to use is_plugin_active, but I like WooCommerce’s method better, as is_plugin_active is a little bit less flexible. Themergency also has a post looking at different methods to check if a plugin is active.

The approach WooCommerce takes is to check if the woocommerce/woocommerce.php file is in the array of active plugins, using PHP’s in_array function.

So if we wanted to check if WooCommerce was active, they suggest to use the following:

In a Recipe Hero extension, Recipe Hero Likes, I need to check if Recipe Hero is active before requiring a couple files that contain most of the extension’s functions. The following is what I use:

How do you like to check if a plugin is active? Do you think there’s an issue using in_array? Let me know in the comments!

Introducing Recipe Hero

I’ve been working on something close to my heart for the past few weeks. It’s called Recipe Hero and it’s going to change the way we eat food.

UPDATE: Website’s Up!

Okay, that’s a little much.

banner-772x250

It’s pretty much just a new WordPress plugin for easily adding recipes to your WordPress site. It has a lot of neat features packed into it, from automatic schema.org mark-up to its own template engine.

I wanted to make it as easy possible for WordPress users to share their amazing food, and I feel like Recipe Hero will do just that.

It’s available now for free on the WordPress.org Plugin Repository.

I’ve got a lot of awesome stuff planned for it. In the next few weeks I’m hoping to move it out of beta into Version 1.0.0 (we’re at 0.6.7 at the time of writing). I’m building the website too at the moment, trying to get all the documentation and a few add-ons ready for it too.

It’s also a completely open-source, GPL-licensed project, and I would love for you to stop by the GitHub Project and contribute in any way you can.

Adding a Header Image to Your WordPress.org Plugin

If you haven’t done it yet, I’m going to help you add a header image to your WordPress.org plugin.

Screen Shot 2014-06-24 at 4.52.41 PM

The plugin header image dimensions need to be 772px x 250px. You may also want to include a retina-ready high-res image, which would be 1544px x 500px.

In your plugin’s SVN repository, there are a few folders. You need to add your image to the assets folder, with the image names as follows:

  • banner-772×250.png
  • banner-1544×500.png

To make it even easier for you to add your own header image, I put together a very simple template file. It’s pretty much just set up with the correct 772×250 dimensions and the matching filename.

Download 772×250 Header Image Template

Stop Including Icon Fonts You Don’t Need

WordPress Theme & Plugin developers: stop it. Sure, I used to do it. I’m not ashamed. I don’t hide from the truth. However, I’ve realised my mistakes and so should you.

Screen Shot 2014-06-21 at 6.40.42 PM

Since WordPress 3.8, the super useful and awesome Dashicons has been included with every copy. You can find it’s home on GitHub here too.

There are almost 200 icons included with it, enough to cover almost every icon-requiring situation you’ll get into. You can easily include them on the front-end and back-end of any site, just by including the CSS for an icon or adding it to a span/div/etc.

For example, just add something like this to your site:

https://gist.github.com/bryceadams/f5112cd6858a1f8317d6.js

With no extra resources being loaded, an icon’s being displayed! Awesomeness.

Update: Devin reminded me in the comments below that most themes don’t actually enqueue Dashicons in the front-end (while a theme like Twenty Fourteen does, your standard run-of-the-mill theme probably won’t). That’s alright, just enqueue it yourself!

https://gist.github.com/bryceadams/84ea0a2bfeb881f8e34e.js

James Koster’s written a great article about using Dashicons in your theme or plugin too. Definitely check it out.

Of course, you’ll often be faced with situations that call for more icon fonts, and that’s ok. But if you can get away with using the included Dashicons set, go for it.

Keep in mind: Users will need to be on WordPress 3.8+ to see the icons! However, you should just include a fallback that will load the dashicons for 3.7 and under.

A New Captain Theme

Captain Theme started over 2 years ago. As I’ve grown as a web developer, so too has Captain Theme.

In the 18 months I haven’t given it the time it deserved. Themes and plugins went un-updated and I’m sorry for that.

I’m back to give it another go and I feel I’ve got a lot more to bring to the table this time around. I’ve already released a new plugin this month, Captain Admin. It’s a premium plugin being sold over at CodeCanyon for $18. I feel it offers a pretty cool set of tools to customise the WordPress admin!

There’s also Captain Team, another new plugin I’ve just released. You should check it out too!

The site has just been given it’s 4th (or maybe 5th?) make-over. I’m happy with how it’s turned out. It’s originally based on James Koster’s Highwind – an awesome free WordPress theme, customised to suit the purpose of the Captain Theme site. So what is the purpose? Really just to provide an easy way to access documentation, support and see the plugins I’ve put together over the years, all in one place.

At the moment I’m working on something pretty special. It’s going to be two things:

  • Free
  • Food Related

I spent a lot of time trying to decide whether or not I should release it as a premium plugin. I decided to head in the same direction as some of the big guys like WooCommerce, Easy Digital Downloads and WP Job Manager and take the free route. I still need to put food on the table though so I will be offering some premium add-ons for a small price too.

I’ll post more about it soon. For now, back to coding!

coding with chloe 2(etonfire.blogspot.com)