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.
Event Listing Ordered by Date
Basic events listing, ordered by date, past events disappearing.
ACF, WP Query, WP/CP | Type: PHP
Exclude Posts with a Particular Custom Field Value
You can exclude all posts that don’t have a particular custom field value. In this example, ‘events’ posts with event_type other than ‘Workshop’ will be displayed; [...]
WP Query | 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
UPDATE: Moving to PHP8 from PHP7.4, there was a problem with the format of the original filter form throwing an error. I have not tested this [...]
PHP, WP Query, WP/CP | Type: PHP
Fix ‘Invalid argument supplied for foreach()’ error
Specifically, this code applies to gravity-forms-custom-post-types/gfcptaddonbase.php, but it could apply to other instances of the error. Original code: foreach( $form_or_field['fields'] as $field ) { if( $this->has_tax_enhanced_ui( [...]
Fixing Fixed Header Problems
html body { position:static !important; } /*fixes many(!) issues caused by fixed header*/ .anchor::before { display: block; content: " "; margin-top: -75px; height: 75px; visibility: hidden; [...]
CSS | Type: CSS
Flexible Content
Uses display:flex; to reorganize content on smaller devices.
CSS3 | Type: CSS
Force Private Post
Have used this for user-created content that is not for public.
Custom Admin, Users, WP/CP | Type: PHP
Full-width Responsive Autoplay Video Slider
This is an autoplay video slider. It's a lot like the single full-width video, but with an additional container to hold the video slides and jQuery to make it slide.
ACF, CSS, jQuery, PHP, Video | Type: Javascript
Full-width Responsive Autoplay Video with Text Overlay
This is a single, autoplay video hero that takes the place of an image slider, most often included on a homepage. Text is overlaid on the video, allowing messaging and a link to another page related to the message.
ACF, CSS, PHP, Video | Type: CSS






