Posts tagged “wordpress”

Stop users from submitting Gravity Forms form twice

A common problem with input forms is that users get impatient and click the submit button twice. This can lead to double (or triple, or quadruple!) form submissions, which can really mess things up (especially if you've added a billing step to your form!) Stopping it can be surprisingly complex, but here's a simple piece of browser script that will prevent most users from making multiple submissions with Gravity Forms.

Remove all meta boxes from WordPress post edit form

When you create a custom post type in WordPress, you can ask register_post_type to generate a default UI for managing your post type in the admin. When you edit your post type, WordPress generates the familiar post editor, just for your post type. You can change it through a variety of hooks, e.g. if you want to add some new meta boxes. But what if you don't want any meta boxes, not even the standard ones?

WordPress admin_init hook and the elusive typenow

In my quest to bring an object oriented separation of concerns to my WordPress plugins, I tend to separate the administration of each custom post type into its own class. I do this by looking at the global variable $typenow after the admin_init action is fired. But $typenow isn't always set after admin_init, so I have to improvise a little.

Using jQuery’s ajaxSend event to change an AJAX request

Customisation of web software sometimes requires that you get it to pass around some additional information whenever it makes a page request. Often, putting that information into a cookie isn't appropriate, so you try to squeeze it into the page query parameters, or form post data through hidden fields. But what if the software makes AJAX requests from jQuery? Luckily, jQuery can help you intercept AJAX requests so that you can customise them too.

WordPress is_ssl() doesn’t work behind some load balancers

WordPress has a function is_ssl() that it uses to check whether a page is loaded with the HTTPS protocol, so that it can use the same protocol to load scripts, stylesheets, and other assets. It relies on the web server giving it a couple of clues, but when your website is hosted behind a load balancer, those clues aren't always available. In particular, websites hosted by Network Solutions get no clues at all when pages are loaded over HTTPS.

Stop Events Manager from cropping thumbnails

Events Manager gives you a special placeholder that you can put into its templates, for inserting the event's "featured image" into lists and single event pages. If you want to insert a thumbnail, it uses the timthumb script to create one on the fly -- but it crops that thumbnail. Here's how to use the WordPress uncropped thumbnail (or any registered image size).

Overview of building custom fields for Gravity Forms

Gravity Forms is a great way to build all sorts of forms in WordPress. It can be so simple that non-programmers can easily build their own basic forms. It's also incredibly flexible so programmers can extend it in myriad ways, even by adding some complex custom fields of their own. But as usual, there's a trade-off -- ease of use for non-programmers means lots of hoops to jump for programmers. Here's an overview of how I built some fairly complex compound fields for a custom application using Gravity Forms.

Events Manager locations map with directions

Events Manager is my events and bookings plugin of choice for WordPress, because it is very flexible, easy to integrate into a theme, and has hooks galore for customising to suit almost any requirement. Its location map doesn't offer a way to provide directions, however. So, here's how to replace the Events Manager locations map with WP Flexible Map and get a directions link on location pages.