How to Get The Domain and TLD from a URL using PHP and Regular Expression

How to get a domain and it’s TLD from a URL string using PHP and Regular Expression: preg_match(“/[a-z0-9\-]{1,63}\.[a-z\.]{2,6}$/”, parse_url($_url_string, PHP_URL_HOST), $_domain_tld); echo $_domain_tld[0]; This is particularly useful for dealing with country TLD’s, like co.uk, on.gc along with the general .com, .net, etc. It is also capable of ruling-out multiple subdomains like: http://i83tr.cdn-2.delivery.net/homepage/sprite.png so you end… Continue reading How to Get The Domain and TLD from a URL using PHP and Regular Expression

Can’t Find Documentation on a WordPress Function?

QueryPosts.com is a great site for documentation and source details on WordPress functions. WordPress.org’s Codex is an essential site for referencing the inner workings of WordPress and does have a long list of documentation covering most of the WordPress functions, but does not cover all the functions available in WordPress and doesn’t show the functions’… Continue reading Can’t Find Documentation on a WordPress Function?

RSYNC – Fastest Way to Download a Clone of any directory

RSYNC is the fastest way to clone and sync directories from any server. Below is an rsync example using ssh tunneling on port 2222 to a server using cPanel, thus the exclusion of the .cpanel and public_ftp. /home/user is the folder to clone/sync to /Volumes/HardDrive/BackupLocation. And a log file is created to log any issues… Continue reading RSYNC – Fastest Way to Download a Clone of any directory

PHP, Dynamically Checking Colors for Legibility Contrast

When writing code to dynamically create background colours and text colours, there is always the potential those two colours will not look appropriate together, and will either render the text illegible or create oscillating text. Enter Split Brain .org‘s Color Contrast Checker It’s a very helpful script, to prevent some illegible dynamic text colors from… Continue reading PHP, Dynamically Checking Colors for Legibility Contrast

Wordpess 3.4+, Using Theme Customizer

WordPress 3.4 introduced the Theme Customizer API. An excellent way to include customization options into a theme build. These features are not well documented on the WordPress.org Codex site, but there are several pages online that dig a bit deeper into the options and inner working of the Theme Customizer API. External References: https://codex.wordpress.org/Theme_Customization_API http://wp.tutsplus.com/tutorials/theme-development/digging-into-the-theme-customizer-components/… Continue reading Wordpess 3.4+, Using Theme Customizer

Verify Your RichSnippets / Schema.org / OpenGraph / Microformats

Another useful tool from Google: http://www.google.com/webmasters/tools/richsnippets A very useful tool for when you’re trying to verify your: Rich Snippets (Google’s name for all types of descriptive meta info.) Schema.org (Google’s backing this one) OpenGraph (Facebook implemented this one) Microformats (The old, but still supported, version)