When your website means business.

Snippets

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.

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 user type? Added Multiple…
CPT, WP/CP | Type: PHP

Namespace; if function exists»

WP-PageNavi CPT LISTING <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(array('query' => $newslist )); //$newslist is name of query for 'news' cpt } else { echo 'Please enable WP-PageNavi!'; } ?> ALTERNATIVELY FOR BLOG…
PHP, WP/CP | Type: PHP

Nested Repeater»

How to display a repeater within a repeater (with conditionals).
ACF | 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

Pre Get Posts»

Set up query parameters for different CPT archives.
WP Query | Type: PHP

We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept