A collection of (mostly) WordPress/ClassicPress-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 other snippets or references.
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]; [...]
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
Toggling search form and focus search field
Nothing tricky about toggling a search form, but making the search field focus upon showing was hard to find. For an example, see the search button [...]
Forms, Javascript, jQuery | Type: PHP
Turn Start Date into Pretty Date
Once you've established a date, display it as you like (see catholic fdn single-events.php for complex usage)
ACF, PHP, WP/CP | Type: PHP
Ultimate Guide to WordPress Conditionals
An excellent resource for WP developers; includes examples.
¡Important!, WP/CP | Type: PHP
Unset Intermediate Thumbnails
Sometimes you don't need intermediate sizes. Snippet shows you how to lose them.
Media | Type: PHP
Unsplash Placeholder Images
Various ways of displaying Unsplash images (using Unsplash as CDN)
Images | Type: PHP






