Snippets: 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

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

More WordPress tags to PHP Variables

$pix = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); $title = get_the_title( $ID ); $eventlink = get_the_permalink(); $excerpt = get_the_excerpt(); $url = get_template_directory_uri();
PHP | Type: PHP

PHP 7.2 Countable issue

Before PHP 7.2 when passing a non-array to count(), it returned 1. With 7.2, count() emits a warning when you give it a non-array.
PHP | Type: PHP