Fun With Dates

Working with dates in PHP can get cumbersome. Especially when you need to calculate a date occurrence in the past or future. These examples should help get those dates, and output them in a human readable format. PHP Date Formatting Y 4 digit year (2018) y 2 digit year (18) F Long month (January) M …

Fun With Dates Read More »

Replace @import in WordPress Child Themes

Stop using @import in child themes. Use the following code in your functions.php file to enqueue the parent theme style.css file, and avoid using @import. reference:

Working With Taxonomy’s

I recently needed to work with a taxonomy that was created for a custom post type, where I needed to access the parent taxonomy.  I came across this same code in the wordpress support forums.  It should be useful when working with taxonomy’s in the future. reference:

Useful Regular Expression

This is a collection of useful regular expressions that I’ve found useful in doing some powerful manipulation of text, or extracting specific data. source source source

$_SERVER[‘DOCUMENT_ROOT’], You’ve Done Me Wrong

$_SERVER[‘DOCUMENT_ROOT’] is good for getting the full path to your websites root folder, but depending on the DocumentRoot directive in httpd.conf you may or may not have a forward slash at the end of the returned url.  This always annoys me when developing locally and everything is working.  Then you upload and test on the production system, …

$_SERVER[‘DOCUMENT_ROOT’], You’ve Done Me Wrong Read More »

Output Encoded PHP String for Use in a Javascript Variable

The problem with just echoing a php sting for a javascript variable is escaping the sting properly for single and double quotes and line returns.  I found this fix for my problem with an apostrophe in the string that closed out the quote early.  This is a better option that trying to use  addslashes.  Use json_encode instead. …

Output Encoded PHP String for Use in a Javascript Variable Read More »

Scroll to Top