I tend to get a lot of questions around checkbox handling when submitting forms to PHP. Here’s a simple snippet to illustrate how it works: A couple things to pay attention to here… 1. Notice the input names. They follow this pattern name[key]. The name is really the name of the “group” of checkboxes. The key is the name of that individual checkbox. This is how you know which checkboxes were checked and which weren’t. When submitted, this form will only include the checkboxes that ARE checked. 2. Notice the created array. When this form is submitted the output will
It was mid-June 2011 in Texas. I had just been released from Active Duty for the Army and was on my way to pick up my then 3-year-old son, Davin, from daycare. I pulled into the parking lot, hopped out of my car and headed toward the front door of the daycare. I remember feeling the heat hit my face as I strode across the parking lot. It was hot… but it was a beautiful summer day. Not at all like what I was about to discover inside the daycare. I made my way across the parking lot and in the
Prior to WordPress 3.8, you had the option to select the number of columns you wanted on your admin dashboard. Personally, I prefer 2. However, in version 3.8… that option is gone. Here’s a handy little code snippet to bring it back: Just change all instances of “2” to the number of columns you’d like your admin dashboard to have and drop the code into your theme’s functions.php file and you’re all set.
Prepared statements are all the rage right now in PHP development… and for good reason. Not only do prepared statements make your queries more secure… they also help future-proof your code by relying more heavily on PHP itself for that security. If you’re not using prepared statements in your queries, you really should be. Here’s a simple class that helps you do just that using MySQLi: I recommend walking through this code and unraveling how it all comes together. There are a few gotchas when using prepared statements in a dynamic way like this. Or you could just check out
Often, when working with WordPress, you’ll find the need to grab a post’s thumbnail source URL. Unfortunately, the_post_thumbnail() and get_the_post_thumbnail() only return the entire image tag. This handy little WordPress code snippet takes care of it for you, though: As you can see, you can post in a $post object or let it use the globalized $post object… depending on your needs. You can also pass in the image size you’re after. By default, it uses the “thumbnail” size. Hopefully, you find it useful.
Media queries are the cornerstone of responsive web design. They are what make the kind of advanced responsive design we see today even possible. So, here’s how to master using them… So, What ARE Media Queries? Here’s the official definition from the Mozilla Developer Network: Media queries consist of a media type and can, as of the CSS3 specification, contain one or more expressions, expressed as media features, which resolve to either true or false. Huh? Think of media queries as conditional statements. You create a query that either resolves as true or false… and if TRUE, you designate certain
I’ve been coding for almost 10 years now and I’m finally fully embracing that coding isn’t for me. It’s taken me awhile to reach this point, but the release of frustration is pretty amazing. Please read on, though, because it’s probably not what you think. You see, when I first started out coding… I did it for me. It was about me expressing myself, doing what I loved, making ME a living. But, the reality of coding is that you’ll spend the majority of your time building stuff for other people. And, that’s why coding isn’t for YOU… it’s for
Brace for impact. As we near the end of 2013, you’re going to be hit with an onslaught of “how to succeed in 2014” posts. That’s all fine and well… But, sometimes knowing what NOT to do can be more powerful that knowing what TO do. This is one of the times. Imagine this… Imagine if you were around 100 or so years ago and were a horse and buggy maker. Imagine if you had ignore this new “fancy” technology called a combustion engine that was making waves at the time. Imagine how in a few short years you’d be
[powerpress] How to Subscribe to the Podcast Subscribe on iTunes Subscribe on Stitcher (Android) Subscribe via RSS It’s Really All About Fear, Isn’t It? Today’s going to be a little tough I think… because today is about standing in front of the mirror a little bit. Let’s talk about fear. Let’s just put it on the table… you’re scared. It’s okay. So am I… every day. Scared you don’t really know what the hell you’re doing. Scared somebody will find out. Scared somebody will see your code and flame you into oblivion. Scared you’ll wreck your client’s site. Scared you’ll
[powerpress] Awhile back, I posted a video talking about how you can make more money in web design by laser-targeting the services you offer. Since then, I’ve received a little push-back from a few coders and I wanted to address their concerns. Their two main arguments are: Being too specific will cause you to lose jobs when you’re first starting out. You have to build up credibility/rapport before you can start targeting more specifically In the podcast, I cover both of these… but let me briefly summarize the points I made: You CANNOT Get Too Specific. Period. It’s as close
Here’s a little code snippet to move the primary navigation in the Geneses theme to the top of your pages: Of course, you could use this to hook the primary navigation in anywhere on the page. You’d just use a different hook with your add_action() statement.
iOS and Android have forever changed what people expect from their technology. For the most part, however, that wave of expectations hasn’t hit the WordPress community. Sure, WordPress itself functions a lot like iOS and Android in a platform/app context… But, most of its plugins don’t. That is changing. And, in this new world… you’re either a plaform or an app… but you’re NEVER a plugin. App vs Platform iOS is a platform. Android is a platform. WordPress is a platform. Evernote is an app. Gmail is an app. SmartS3 is an app. Platforms are the operating system. Apps are the software that run
Graham recently asked me: Do I still need to used mysqli_real_escape_string when used prepared statements in PHP? The simple answer is no. The way it used to work is that you would take form input data, put that into a variable, and inject that data into your MySQL query in order to add that data to the database. Now, a big problem with that is SQL Injection attacks where a hacker could inject SQL code into your query and perform actions on your database… which is something you definitely don’t want. So, the standard solution became using mysql_real_escape_string to sanitize
Listen to the Full 30-Minute Podcast Version [powerpress] Let me give you an example: Yesterday, I was feeling completely burnt out. For the last couple weeks, I had been pushing real hard on a number of projects, working late nights, and basically strapped to my desk 24/7. And, it was starting to catch up to me. But, I had one more project I needed to finish and I really didn’t want to do it. Now, I’ve learned over the years that the quality of my work is pretty horrific when I force myself to work when I don’t want to.
Listen to the Full 30-Minute Podcast Version [powerpress] Are You Losing Money Trying to Be Everything to Everybody? I have 100% been guilty of this. When I first started marketing my services, I had a shotgun blast of an offer hoping potential clients would pick up on something and get in touch with me. The problem? It reeks of desperation. And, clients don’t want a desperate developer. The more you try to be everything to everybody, the more you’ll be nothing to nobody. Potential clients won’t really know what your strengths are and what your core offer is. And, they’ll
You know, I’ve spent a lot of time teaching coders technical skills. How to upload files using PHP, how to create website templates, how to hack, twist and mold WordPress to your will, and so on. In fact, the entire site over at LearnPHP.co is about exactly this when it comes to PHP. I have an entire category on this site called Code Snippets where I do exactly that. All of my YouTube videos do the exact same thing. But, to be honest, I’ve never really talked much about what it REALLY takes to be successful as a developer. Because,
I’ve seen a rash of really bad job postings on Elance lately and I thought I’d step in to offer a little (ahem) constructive criticism. Here’s the thing. Bad job postings are bad for everybody, because they lead to unclear expectations. Developers hate it because we have no idea how to bid these kinds of jobs… and the job posters hate it because they always end up paying more and getting less. Now, certainly there’s something to be said for how a developer should submit their proposal back; however, 1) I can’t see how other developers do it, so I
What will the future of content monetization look like? Are we forever stuck with an ad-based, privacy-encroaching business model (ala Facebook)? Does the failure of NewsCorp’s “The Daily” mean fee-based content is dead? What is the trend and how can you profit? These are the questions I want to answer in this article. I’ve been thinking about content monetization a LOT lately. Not because I’m weird, but because that’s what the company I work for (WishList Products) does… at least in my eyes. Right now, we call ourselves a membership site plugin, but let’s be real… our software does a
In my last post, I talked about how to add a custom meta box with a custom link to WordPress navigation menus. Several times, I mentioned how I needed to add a specific class to that link for WishList Login 2.0, so that I could find that link later and do stuff with it. This is the part where we “do stuff” with that link. Specifically, we’re going to hook into the navigation menu before it displays, find our link and change its display based on the current user’s login status. Here’s what it looks like: So, if they’re logged
The simple secrets to high-paying freelance clients
What makes clients willing to pay $5,000, $10,000 even $20,000 and up for your services? Download and install my mobile app and I’ll show you. It’s free. Just click the button below:
WHAT OTHERS ARE SAYING
John and I have worked together on numerous projects. John is very quick and efficient and was a pleasure to work with.
John is amazing at building membership sites. He converted one of my sites over from it’s existing (hardly working) platform over to the clean and simple to use WishList membership platform. I highly recommend using John and WishList for any of your membership site needs.
Not only is John a very talented programmer and developer, he is also an excellent communicator. He has a talent for taking complex subjects and communicating them in terms that anyone can understand. This is a rare combination. This ability has enabled me to take my skills and knowledge to the next level. Thank you John for for all that you do.
I’m a fan. I have completed several of John’s courses. I find him very knowledgeable and he has a great delivery.
John Morris is exceptional in his ability to give focused insight into Freelancing and starting one’s business. His direct methods inspire confidence in his honesty.
On the Freelancing on Upwork course: “This is by far the best course i have watched on Skillshare!! Thank you so much.”
I recommend John every chance I get. If every person I worked with were as committed to excellence, punctuality, value, and unquestionable integrity… the world would be a better place. Highest recommendation.
John has a relaxed and engaging manner. His advice is solid and the explanations are well thought out.
John has provided expert knowledge and advice on multiple occasions that have helped me better serve my clients. John is a Rockstar!
John is top-notch and a great guy to work with.
John is a fantastic and patient tutor, who is not just able to share knowledge and communicate it very effectively – but able to support one in applying it. However, I believe that John has a very rare ability to go further than just imparting knowledge and showing one how to apply it. He is able to innately provoke one’s curiosity when explaining and demonstrating concepts, to the extent that one can explore and unravel their own learning journey. Thanks very much John!
John really delivers!
John is one of the best instructors I have come across, I learned a lot from his online tutorials.
Very professional worker who is extremely knowledgable in WordPress and Wishlist Member. I would definitely hire again.