Popular Posts
All posts ordered by popularity
jQuery Open Links in New Tab
Over the years, I’ve collected various JavaScript techniques for opening external links in their own tab. Here they are, all in one convenient post..
WordPress Check User Roles
Here is a plug-n-play function to check user roles, based on an array of input values.
jQuery Truncate Text
Here are a few choice code snippets to truncate text with jQuery. Useful for fine-tuning responsive layouts, or just truncating strings of text in general.
Break Out of Frames
This tutorial explains some ways to use JavaScript to prevent your pages from being framed. Also known as “frame busting” or “breaking out of frames”.
Automatic versioning for enqueued stylesheets
Learn how to append the theme version, random number, or both as a query-string parameter to your CSS stylesheet URLs. This is useful for automatic versioning, cache-busting during development, or both.
PHP: Get current URL
Nice lil slab of PHP to get the current URL. Useful for a wide variety of applications, nice one to have in the tool belt.
Members-only content via shortcode
Here is a sweet little WordPress shortcode to display content only to logged-in users. Visitors not logged in will see a custom message saying whatever you’d prefer.
PHP Truncate Text at Word
Here is a PHP snippet to truncate a string of text at the specified number of words. This is a nice alternative to just shortening a string of text based on character count. With this technique, the truncated string contains only complete words and is readable.
.htaccess template file for WordPress
By default, WordPress does not require any .htaccess rules to function properly. But if you want to enable pretty permalinks, a simple set of .htaccess rules must be included in your site’s root .htaccess file.
kses tricks
In WordPress, “kses strips evil scripts”. Here is a list of kses tricks for ninjas only.
WordPress template_redirect Example
Quick code snippet showing basic use of the WordPress template_redirect action hook. This is provided as a quick copy/paste reference for WordPress developers. This hook is useful for customizing any functionality requiring full query information.
WordPress Require User Login
This post shows a quick and easy way to require that the user is logged in to WordPress in order to gain access to some private content.