Web Dev Snippets

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.

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

Move Yoast Metabox to Bottom

Yoast Metabox is huge, and it gets in the way of a lot of stuff. Move it to the bottom of the edit screen with this handy snippet.
WP/CP, Yoast | Type: PHP

Multiple Templates for Custom Post Type

Number of possible solutions; have not tested any of them yet. Maybe trying to make this too complicated: what about serving different template parts based on [...]
CPT, WP/CP | Type: PHP

Pagination without a plugin

Truthfully, I’ve relied on WP-PageNavi for pagination for years. I recently tried Simplistic Page Navi, and I like that as well. But if you want to [...]
Pagination, WP Query | 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