A collection of (mostly) WordPress/ClassicPress-related snippets and references I’ve found useful and worth keeping where I can find them.
NOTE: Some of these snippets are old and may be outdated. Feel free to use what you like, and point me to better 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 WordPress Admin Bar to Bottom
Move admin bar to bottom to get it out of the way of menus at top on fixed heads.
CSS, Custom Admin, Users | Type: CSS
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
Namespace; if function exists
WP-PageNavi CPT LISTING ALTERNATIVELY FOR BLOG LIST
PHP, 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
Paging CPT Listing on Static Home Page
Paging a query on static page set as home page (clicks to /page/2 but continues to show original items)
WP Query | Type: PHP
Patch count(): countable in wp-includes/post-template.php on line 284
Normally a bad idea to patch a WP core file, but here’s the patch: // original code: if ( $page > count( $pages ) ) //add [...]
PHP, WP/CP | 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
PHP Date/Time Guide
Useful php date/time formulas.
¡Important!, Date/Time, PHP | Type: PHP






