Creating custom functions in your WordPress template’s function.php file is a regular thing for many of us. What you might not know is how easy it is to wrap them in a class, or even why you would. Wrapping them in a class keeps them both organized and self-contained from other functions that may have the same name. This can be especially important if you are using third party plugins. Continue reading Using PHP Classes and Functions in WordPress
I recently set out to customize WordPress profile fields for a specific role. You may want to have custom fields for users, but have different fields for different roles. For example, Authors may need some additional contact information, while Subscribers need only some basic fields. The concern I had was wether or not an Admin would be able to pull up any profile and edit all of the fields. Here’s the solution I found. Continue reading Role Based Profile Fields in WordPress
Building a custom HTML form for WordPress is something I do fairly regularly. When adding an upload form, it’s important to check for allowed file types. You wouldn’t want anyone uploading a malicious PHP script, right? Wouldn’t it be great if WordPress did that for you? Of course it would. Continue reading WordPress File Uploads Checked By MIME Type
Often times, people want a way to modify the look of the registration form page in WordPress. However, this desired outcome is often misplaced. What most people want to do is simply place the form on a page, such as the home page or special registration page. Continue reading Customizing The WordPress Registration Form
Bootstrap has a way making a lot of HTML elements look good, right off the bat. But the day finally came when I had to face to inevitable: The <input type=”file”>. This is the red headed stepchild of Bootstrap (and browser makers). Browsers render this element differently from each other, making it nearly impossible to look good across the board.
When creating php web forms, there are a few things I always like to have in reach. Don’t expect anything groundbreaking in this list of tools and code snippets. I will also try to update the list as time goes on. Continue reading PHP Web Form Snippets and Tools
Alright, I have to confess. This took me some time to wrap my head around. It also seemed like a lot of people were having the same problem. The question is “How do I add custom post meta fields to the quick edit function in WordPress?”
For some reason, I had a hard time finding the answers I needed in Google. I must not have been asking the right question or something. So here is what I learned. Continue reading Understanding the WordPress Quick Edit Custom Box
A common issue with CSS is finding the best way to set an element, such as a div, to stretch from the top of the screen, to the bottom of the screen. You can do this with positioning. Sometimes, though, you want the div to start from after the banner, navigation, or something else. This creates some additional variables. You also need to account for what happens if someone resizes the screen. Continue reading Set a Container to the Window Height with jQuery
A speedbump is a essentially a confirmation dialogue when a website visitor clicks a link to leave your site. Speedbumps are actually required by law in some countries for industries such as Credit Unions and banks. There are several ways to create a speedbump, and I’m going to show you just one way. You can borrow or adapt any part of these methods for your own site. Continue reading Create a SpeedBump with jQuery & the Bootstrap Modal
It’s not often that spam gets past my defenses. However, when it does, it’s really annoying. So today I set out to stop comment form spammers from submitting forms with one or more links.
PHP’s STRISTR searches a string for anything that matches your search. So, searching for “http://” will return true if it is found in the string. This will only work on form fields that you do not want to allow a link to be added. So, it may help to give visitors a heads up before they post a comment with a hyperlink included. Continue reading Use PHP STRISTR To Stop Comment Form Spammers