WordPress menu login / logout link
The WordPress drag-and-drop menus make it easy to build a custom menu for your website, but adding a login/logout link requires a little PHP code. It's very simple though, and easy to add to any theme.
The WordPress drag-and-drop menus make it easy to build a custom menu for your website, but adding a login/logout link requires a little PHP code. It's very simple though, and easy to add to any theme.
WordPress has a good API for adding admin menu items. Unfortunately, it doesn't allow you to specify a direct link to something, only a "slug" that links your menu item to a callback function to run when your menu item is selected. But fortunately, there's a hack.
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.
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?
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.
The eWAY Payment Gateway plugin now has integrations for WooCommerce, Events Manager Pro, and Another WordPress Classifieds Plugin with support for Australian customers of eWAY. And it's still free!
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.
When you edit a new post, page, or an object of a custom post type, WordPress generates a slug or post name that will be used in its permalink. It derives the post name from the title you gave it. Sometimes, however, you want the post name to have a little more information in it.
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.
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).
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 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.