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.
Disallow Indexing of PDFs in Media»
Important if PDFs are only available behind login or downloadable after transaction.
¡Important!, eCommerce, WP/CP | Type: Other
Display Dates if Start and End Dates Same Month»
Handy snippet for displaying event dates when events can stretch over multiple days.
ACF, PHP | Type: PHP
Display Featured Image on Listing»
How to add featured image to other post types. ADD TO THEME FUNCTIONS // This theme uses post thumbnails add_theme_support( 'post-thumbnails', array( 'plans','listings','news','post' ) ); ON POST-TYPE SPEC 'supports' =>…
Images, PHP, WP/CP | Type: PHP
Divs Same Height»
Make divs in a container equal heights.
Javascript, jQuery | Type: Javascript
End of Text characters, u0003, aka ‘mystery characters’»
Apparently, there can be a mismatch of encoding after a db update by your webhost, and it can result in odd characters appearing in text. This might fix it. Comment…
wp-config | Type: Other
Event Listing Ordered by Date»
Basic events listing, ordered by date, past events disappearing.
ACF, WP Query, WP/CP | Type: PHP
Filter Custom Post Type by Custom Fields»
Can be found on an Evo blog post with more explanation.
ACF, PHP, WP Query, WP/CP | Type: PHP
Filter Custom Post Type by Taxonomy»
Can be found on an Evo blog post with more explanation.
PHP, WP Query, WP/CP | Type: PHP
Fix to Top Onscroll»
Positions element at top on scrolling using jQuery scrollTop.
Javascript, jQuery | Type: Javascript
Flexible Content»
Uses display:flex; to reorganize content on smaller devices.
CSS3 | Type: CSS