Blog Category: PHP

Change How Date Fields Display in User Insights Plugin

June 24, 2020 PHP, Plugins, WordPress

Change How Date Fields Display in User Insights Plugin

After adding a new custom field to the User Insights plugin recently, I wanted to change how the date fields were displaying. Luckily, User Insights has provided a filter that we can use.

Read More

How to Adjust the Placement of Related Posts for WP Plugin

February 21, 2020 PHP, Plugins, WooCommerce

How to Adjust the Placement of Related Posts for WP Plugin

By default, the Related Posts for WP plugin displays the lists of posts after the primary content area, which is printed using a WordPress function called the_content(); on each page. …

Read More

WordPress Function to Easily Include Files

July 6, 2014 Development, PHP, WordPress

WordPress Function to Easily Include Files

When building a website these days, include files are incredibly useful for the common pieces such as the header, footer and sidebar. In WordPress, I usually stick with the basic …

Read More

Stopping WordPress From Redirecting Matched Slugs

July 1, 2014 Development, PHP, WordPress

Stopping WordPress From Redirecting Matched Slugs

A friend of mine asked recently why an old link was redirecting to a similarly named page in WordPress. Even though the page had been deleted, the link was still …

Read More

How to Show HTML Special Characters in Textarea

June 15, 2014 Development, PHP

How to Show HTML Special Characters in Textarea

After adding Prism code highlighter to this blog, I quickly found out that all HTML opening angles, which look like <, need to be written in their special character form, …

Read More

Only Show Posts in WordPress Search Results

May 30, 2014 Development, PHP, WordPress

Only Show Posts in WordPress Search Results

By default, the WordPress search shows results from pages and posts. One client only wanted to search their blog posts and not the rest of the pages on the site. …

Read More

Using mysqli_data_seek() Function to Grab Random Row

July 31, 2013 Development, MySQL, PHP

Using mysqli_data_seek() Function to Grab Random Row

I wanted to use a set of database results twice on a page but didn’t want to run the database query again. Using the mysqli_data_seek() function, we can reset the …

Read More

How to Tell if a Variable is Odd or Even

July 17, 2013 Development, HTML, PHP

How to Tell if a Variable is Odd or Even

While creating divs for a recent project, I wanted to assign a class to the even containers so they would float right. Container #1 would float left, #2 would float …

Read More

Creating a Custom Excerpt with Two Paragraphs

July 17, 2013 Development, HTML, PHP

Creating a Custom Excerpt with Two Paragraphs

For my website, I have written a lot of news articles over the years and I wanted to print out an excerpt for each one. Instead of writing an excerpt …

Read More

How to Check if a Variable Includes a Number

July 17, 2013 Development, PHP

How to Check if a Variable Includes a Number

For spam checking in an email script, I wanted to see if the name field had any numbers in it. Spammers write code that automatically fills out contact forms and …

Read More

Let's Talk About Your New Website

View Portfolio Contact Today