Randomize Woocommerce Related Products

Woocommerce has a built-in related products section that pulls product recommendations from the assigned categories and tags for the current product. It works as described, but it has its drawbacks with how it works as well. We are going to look at a couple easy-to-implement code snippets that overcome the main flaws of the default […]

Display Categories in the Woocommerce Product Loop

The eCommerce plugin Woocommerce is pretty standard for WordPress retail websites. Woocommerce by default does not display categories on the product loop (shop page), but I recently encountered an instance where we wanted to display all the categories that each product was in within the normal loop. In this case, we also had removed links […]

Combine WordPress Menus Dynamically on Mobile Devices

Many WordPress themes and designs have a main menu that contains the bulk of navigation links and a secondary menu that contains some other variety of links. With a responsive website we need to figure out what to do with these two WordPress menus when on a mobile device since we don’t want to be […]

Add a Mailchimp Subscriber with PHP

You may want to add a subscriber to a Mailchimp list, but can’t or don’t want to use one of their pre-made code snippets to plug into your site. One popular reason is to avoid the confirmation email that Mailchimp will send. Others may just want to merge subscribe functionality in with a larger form. […]

Passing Contact Form 7 Data to the Thank You Page

UPDATE (8/6/17): Contact Form 7 is deprecating the use of ‘on_sent_ok’ and will be removing it entirely by the end of 2017. Please see my new guide on the DOM Events Method of Passing Contact Form 7 Data that will cover this exact same topic using the new preferred method. I recently had to use […]

Change Genesis Footer Text

Whether you are using the default Genesis Framework or a Genesis child theme, you will probably see text in the footer that contains a link back to studiopress or the theme author that you will want to edit. This can easily be done using either action or filter hooks in the functions.php file depending on […]

DigitalOcean Error Establishing a Database Connection Fix

I’ve worked on a lot of sites that were hosted on DigitalOcean at this point so I’ve seen many VPS issues that have had to be resolved. I’ve used Ubuntu 14.04 the most on these setups, so this post will use Ubuntu commands. One issue that can have many different causes is the classic “Error […]

CSS Transparent Gradient Overlay on an Image

Sometimes you may want to tint an image or add a gradient. This can obviously be done with an image editor like Photoshop, but it can also be done purely with CSS using the background property. Using CSS to do this instead of changing the image itself saves time if modifications to the image style […]

RegEx to get the Root Domain from a String of HTML

Extracting URL’s from a string of HTML text using the php preg_match_all() function can grab you an array of the full URLs or an array of just the root domains depending on the RegEx used. I’ll provide a premade function snippet that you can use for both. The only difference between these two functions is […]

RegEx to Find a Word within a String Using preg_match

When using preg_match to find a word in a string, you’ll find that the default regex used in most examples  (ex: “/needle/i” ) works perfectly fine for finding if a pattern occurs in the string, but if you are looking to find a specific word it can get you unexpected results. For example, if we want […]