A collection of (mostly) WordPress-related snippets and references I’ve found useful and worth keeping where I can find them. Feel free to use what you like, and point me to some better snippets or references.
Set Cookie, Change Content (or change class)»
Using a cookie to change content for repeat visits.
Cookies, CSS, PHP | Type: PHP
Show remaining entries on Gravity Forms registration form»
Displays number of entries remaining for a particular form in a shortcode
Forms | Type: PHP
Show Tags for Only One Category»
Decided not to do this on a project after finding this snippet, but kept the snippet just in case. query_posts('category_name=news'); if (have_posts()) : while (have_posts()) : the_post(); //replace 'news' with…
WP/CP | Type: PHP
Show/hide text with row truncate»
This avoids the mid-word break of the other show/hide snippet by selecting number of rows to show.
CSS | Type: PHP
Sliding Image Background»
Cool effect if you have a good enough reason and a wide enough image.
CSS, CSS3, Images | Type: PHP
Specify minimum size for image upload»
//specify minimum size for uploaded images (including featured images) add_filter('wp_handle_upload_prefilter','tc_handle_upload_prefilter'); function tc_handle_upload_prefilter($file) { $img=getimagesize($file['tmp_name']); $minimum = array('width' => '300', 'height' => '300'); $width= $img[0]; $height =$img[1]; if ($width < $minimum['width']…
Images, WP/CP | Type: PHP
Stripe Test Card Numbers»
Use these card numbers to test Stripe before going live.
eCommerce, Forms | Type: Other
Styling Embedded Google Calendars»
How to style a Google calendar in an iframe embedded on a page.
CSS, PHP | Type: CSS
Template Tags for ‘Add-to-Any’ and ‘SSBA’ Share Buttons»
Put 'add-to-any' share buttons anywhere on the template.
Sharing, Template Tags | Type: PHP
Toggle List View to Grid View (and back)»
Works very smoothly.
CSS3, Javascript | Type: Javascript