If you have you have a lot of user accounts for subscribers (or customers if using WooCommerce or Easy Digital Downloads), you might find these functions useful for blocking access to the dashboard and simplifying logins. Continue reading
WordPress has a button in the editor for adding blockquotes to a post. But what if an author wants to add a citation? Unfortunately, it’s not possible without a little HTML knowledge.
This is a problem I’ve thought about a bit when designing DevPress themes (what markup should I be styling for?), but it’s also come up on a few client projects recently. Citations are a pretty common use-case, and it would be great if they were easier to add.
Command line scripts can be excellent tools for fetching and quickly parsing data from an external API.
I recently wrote a script that allows you to search Zendesk tickets for a specific query term, and then returns a list of all associated e-mails. It’s something that’s impossible to do through the Zendesk UI (without a ton of clicking and copying), but really useful.
I thought I’d share it as a Gist in case anyone else might find it helpful.
At 10up we have a guidebook of engineering best practices that all our teams follow. Now that responsive images finally have good browser support, we’ve been trying think through best practices with responsive images.
- Is there a “best practice” for sizes to generate?
- Should all images be generated at multiple sizes and updated with srcset values?
- How will using srcset impact page weight (i.e. worth the effort)?
My initial assumption was “yes”, we should be using responsive images whenever we’re outputting a featured images. Using the “correct” size image can lead to huge performance gains.
When developing WordPress sites I generally have three environments: live, staging, and local. Since I like my staging environment to be a very close replica of production, I frequently overwrite the database and files in staging. This is especially true when working with a host like WP Engine that has one-click staging environments.
However, when the database is overwritten in staging, there’s a generally a few settings that still need to be different from production. For instance, with WooCommerce sites, I may need to deactivate SSL and put Stripe into testing mode.
Occasionally I’ll also need to deactivate certain analytics plugins or third-party API integrations like MailChimp.
After making these updates manually for months, I finally moved to a programmatic update routine for many of my sites. The code basically just checks which environment we’re in. If it’s not production, it checks if the settings have been updated yet. If not, it makes the updates. Continue reading
Sometimes it’s really useful to be able to output HTML in the Customizer that’s not a label or description for a specific control. You may want to output a line break, an image, a button, or simply some additional text.
There isn’t a native Customizer control in WordPress to do this, but you can add your own custom control to output arbitrary HTML. This was a request for the Customizer Library, and the GitHub issue explains the thought process behind the code. Continue reading
Broad Experience is a podcast I listen to regularly. It’s a thoughtful interview show about the experience of women in the workplace.
One recent episode mentioned the lack of women in tech, which hits close to home (87% of of people who follow me on Twitter are male). It’s a complex issue and there’s no quick panacea, but there is at least one easy step companies can take recruit more female engineers: remove requirements from a job description that aren’t actually requirements.
“There’s been research that shows many women will only apply for a job if they meet 100% of the qualifications,” said Erik Michaels-Ober of Soundcloud. “Whereas men will do so even if they meet some smaller percentage. They’re willing to put themselves out there even if they’re not fully qualified.”
“So we looked at a lot of things,” said Erik. “For example, having a college degree was a requirement on a lot of our jobs. But when we looked internally, we realized had hired a lot of male engineers who didn’t have a college degree because they had decided to apply anyway.” Continue reading
A lot of the big services, like Google Analytics (tutorial) or Facebook ads, have off-the-shelf extensions you can use. But for smaller services, you often have to write some custom code to send them the conversion information.
Generally the easiest way to do this is by using the woocommerce_thankyou hook. This action is only fired on the order confirmation page and also provides the $order_id variable, which gives access to all the order details. Continue reading