I was recently asked: Man… I truly hope I can just know what to do at some point without having to ask. You think PHP is an easy language to learn though? When I read that, it reminds of the frustration I felt when I first started learning how to code. It can be very frustrating and make you feel like you want to give up. Should you? Here’s why I think you shouldn’t: It will get easier. The first few months are the most difficult. It truly is like learning a new language… not just a new way of speaking
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
When I created WishList Login 2.0, I wanted to an easy way for users to add a dynamic login/logout link to their navigation menus. As simple as it sounds, it’s not something you can do natively in WordPress and we can requests for this kind of thing all the time. In WishList Login 1.0, I had added an entire admin interface in the plugin settings that had all the necessary options for creating the link, editing its text, setting its position, and so on. Of course, this was before WordPress added menus, so I didn’t have much choice… but, now
What if I could tell you the secret making a major breakthrough in your work… in 2 words? How to stop spinning your wheels 1,000 miles an hour but getting nowhere? How to stop being overwhelmed with “everything you’ve gotta do” and start working on only the things that matter?
In this tutorial, I’ll show you how to create a custom loop in WordPress using WP_Query. Plus, I’ll explain why you want to use this instead of query_posts when creating custom loops like these.
In this video, you’ll learn how to create an .ics import file using PHP. This allows you to dynamically generate the .ics file based on stored event data. Users can then download the file and import the event information in their calendar of choice… Outlook, Thunderbird(Lightning), Apple Calendar, etc.
I’ve been thinking a lot lately about WishList Member and its future. Specifically, how the web as a whole is evolving and what role WLM will play in that web. Looking into my magic “crystal ball”, I’m seeing some exciting things ahead if we take the right approach and develop the right mindset for the changes that are occurring with the greater internet. Of course, none of this makes sense unless you know my Secret Plan for World Domination (add in ominous tone). I don’t mind sharing it, because while it’s simple to understand… it’s pretty damn difficult to implement.
Ethics in business today suck. Entrepreneurs are too focused on profit as the ultimate goal. Profit is NOT the ultimate goal. Business Is a Game In baseball, a power hitter is often measured by how many homeruns he hits. As fans, we idolize and adore good hitters. But, hitting homeruns isn’t his ultimate goal. It’s a means to an end. The end is winning games… and winning enough games to be called a champion. Often times, his legacy depends on whether or not he won a championship… regardless of how many homeruns he hits. And, if he cheats to win,
7 Reasons Why You Should Start Using the Official Facebook for WordPress Plugin (and 3 Reasons Why You Shouldn’t)
Facebook just launched its official WordPress plugin which allows you to “easily” integrate Facebook features into your WordPress website. I’ve spent the last day or so playing around with it and here’s my initial thoughts. Why You Should Install Facebook for WordPress 1. Easy connection to your Facebook account. If you’ve ever setup one of the many Facebook plugins for WordPress, you’ll know that you typically have to create a new application in Facebook, grab the API Key and API Secret from your app, and paste them into your plugin. This plugin is no different, except you only need to
If you’ve been following this site for a bit, you’ll know it’s been primarily about coding and contained all my various coding tutorials and such. Well, that’s changed. I’ve officially moved all my coding tutorials over to http://www.learnphp.co and I’m taking this blog back as my personal blog. If you want the coding tutorials, head over there. Here, I’ll be posting about pretty much whatever I want. You can follow me here if you’d like to keep in touch with me personally. (photo by a2gemma)
In this video, you’ll learn how to sort multidimensional arrays in PHP. You’ll not only learn basic sorting using array_multisort(), but you’ll also see a more advanced custom function for sorting multidimensional arrays by a specific key. Multidimensional arrays can be one of the more confusing parts about learning PHP, but this video will help you get your head around it and give you some tools for sorting your multidimensional arrays that are simple and straight-forward.
This is a question I get quite a bit, so I figured I’d write a post on it: How do I create an HTML select box with options from data in my database? Here’s how: The Query First, let’s look at our query. Yours might look something like this: That will select everything in our table and loop it into an array of objects containing the results. Now, we can take that array and create a HTML select box with it. The HTML Select Box Now, that we have our array of objects from our database we can use it
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 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.
John is top-notch and a great guy to work with.
John and I have worked together on numerous projects. John is very quick and efficient and was a pleasure to work with.
John has a relaxed and engaging manner. His advice is solid and the explanations are well thought out.
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.
Very professional worker who is extremely knowledgable in WordPress and Wishlist Member. I would definitely hire again.
I’m a fan. I have completed several of John’s courses. I find him very knowledgeable and he has a great delivery.
John really delivers!
John has a particular knack for the development and training of others.
John did an outstanding job on my project. I highly recommend him and look forward to working with him on future projects.
John has a habit of over-delivering on the expectations he sets up. That’s why he’s the best.
John is an excellent teacher.
John is a man of integrity, who gives generously of himself to projects and people he cares about.
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!