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.
Eliminate Blue Outline on PopupMaker Content»
.popmake-content { outline:none!important; }
CSS | Type: CSS
Eliminate Caching on Specific Page Templates and Post Types»
Put in your theme’s header.php file: <?php if (is_page_template('page_eventslist.php')) { //conditional, if desired header('Cache-Control: no-cache, no-store, must-revalidate'); header('Pragma: no-cache'); header('Expires: 0'); } ?>
CPT, WP/CP | Type: PHP
Embed Responsive YouTube Videos»
First, the CSS: .youtube-video { aspect-ratio: 16 / 9; width: 100%; } Then add the class to the iframe embed code: <iframe class="youtube-video" src="https://www.youtube.com/embed/xxxxxx" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay;…
CSS, Responsive, Video | Type: CSS
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»
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 code specifically, but I…
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( $field ) ) {…
Fix to Top Onscroll»
Positions element at top on scrolling using jQuery scrollTop.
Javascript, jQuery | Type: Javascript
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; pointer-events: none; } /*offsets…
CSS | Type: CSS