Menu

Snippets

Yet another programmer blogging about code

Archive for the ‘Snippets’ Category

Gravity Forms add-ons need to have capabilities

Sunday, January 1st, 2017

TIL that you need to give Gravity Forms add-ons some capabilities, otherwise they might disappear from the WordPress admin. (more…)

Customise WooCommerce out of stock message

Friday, December 23rd, 2016

Sometimes the WooCommerce out of stock message isn’t quite appropriate. Here’s a couple of ways to change that message. (more…)

Searching custom meta on custom post types

Saturday, November 26th, 2016

Ever needed to search for a post by something other than the title or post content? If you’ve built a website with custom post types that have additional fields, it’s a good chance that admins will need to search on your custom meta. (more…)

VBScript For Next and Continue

Saturday, October 10th, 2015

I still get the occasional Classic ASP VBScript maintenance job from time to time, and it reminds me of the language statements it just doesn’t have. Like “continue”, great for skipping a bunch of logic inside a For loop. Turns out, there is a nice simple way to get that functionality. (more…)

Load Gravity Forms stylesheets in page head

Friday, August 21st, 2015

Gravity Forms normally loads its stylesheets in the page head, where they belong. It does that only on pages which have forms, which is nice. If you use a widget to host your form, however, it can’t detect that until it renders the widget… too late to load the stylesheets in the head. At that point, it just pulls them directly into the page body. (more…)

Disable scroll wheel on Events Manager location maps

Saturday, August 15th, 2015

Events Manager is a really nice, easy to customise plugin for showing events on WordPress websites. One gripe I always have with it is that the location maps zoom when you use the mouse scroll wheel, something I always turn off when I add a map to a page. Here’s how to fix it. (more…)

Hack a WordPress plugin AJAX action

Monday, July 13th, 2015

Customising the AJAX output of WordPress plugins can often be a breeze, when the authors oblige other developers by peppering their code with action and filter hooks. But if they don’t, you can always fall back on hacking the plugin’s AJAX action. (more…)

Fix broken tables in twentyfifteen WordPress theme

Saturday, December 27th, 2014

WordPress 4.1 brings with it the twentyfifteen theme, which I find to be a rather nice blog theme. Unfortunately, it adds a new wrinkle to any tables on your website — often breaking them! Here’s the simple fix. (more…)

Sort WooCommerce products first in search results

Thursday, December 18th, 2014

When shoppers search a WordPress website, you want them to find products first before listing any articles and pages. And it’s surprisingly easy to achieve, with a simple filter hook. (more…)

Set the tab size on GitHub, Gist, and Bitbucket

Wednesday, September 3rd, 2014

I indent with tabs. There, I said it. Viewing my code (and that of other tab indenters) on GitHub, Gist, or Bitbucket can be annoying because the default tab size in the browser is equivalent to 8 spaces. Modern browsers let you change that through CSS, and here’s some bookmarklets that do just that. (more…)