fbpx

Error Establishing a Database Connection

I ran into this error while working on a client site the other day. The steps that I took to solve the issue included the following: Step 1: Check if you can connect to the database in another way Sometimes you may be able to connect to the database via the command line using the…

Check if a String Contains a Specific Word PHP

If you would like to check if a string contains a specific word in PHP, you have a couple options, but, we tend to prefer PHP’s strpos function. If the needle is not found in the haystack, strpos returns false. If the needle is found in the haystack, strpos returns the position of the needle…

Show All Errors PHP

In order to show all errors in a PHP file, you simply need to add the following two lines to your PHP file. Then, PHP will start to throw the error messages back to you, making debugging infinitely easier. Make sure to remove these lines when you push your PHP file to production, as it…

JavaScript isset() Equivalent

If you are familiar with PHP’s isset() function, you know that it is used to determine if a variable has been set and is not NULL. If you do not use the isset() function, you risk throwing a PHP error saying that the variable is undefined. Similarly, if you do not use the following JavaScript…

Access Multiple WordPress Global Variables

If you want to access multiple WordPress global variables in a function, you need to separate them by commas. So, in the function below, we want to access both the wp_version and required_php_version variables. In order to do that, we simply have to separate them by commas. See the example below:

Get WordPress Version with PHP

We needed to get the WordPress version with PHP code and we found a global WordPress variable that you can use to access that. All of WordPress’ global variables can be found at https://codex.wordpress.org/Global_Variables. In order to access the current WordPress version, you need to add the following to your function: Then, you can reference…

Create MailChimp Campaign

Learn how to create a MailChimp campaign in 4 easy steps. We’ll describe what the terminology means and how to start sending out newsletters to your audience. Step 1: Sign up for MailChimp Sign up for MailChimp at https://mailchimp.com/signup/ Step 2: Create List Now that you have an account and are logged into your MailChimp…