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.
Not sure why you wouldn't use a placeholder instead.
Maybe the most widely used clear after float.
CSS | Type: CSS
Sometimes functions are easier to use in conditional statements if converted to variables.
ACF, PHP, WP/CP | Type: PHP
Enable compression in wp-config /* Compression */ define( 'COMPRESS_CSS', true ); define( 'COMPRESS_SCRIPTS', true ); define( 'ENFORCE_GZIP', true );
wp-config | Type: PHP
Conditional based on values for single-value fields (radio buttons, select, etc).
ACF, PHP | Type: PHP
The wpdb object can be used to access any database and query any table. Absolutely no need to be Wordpress related, which is very interesting. The benefit is the ability…
DB Query, WP/CP | Type: PHP
Reverse query from different post types associated via ACF relationship field.
ACF, CPT, WP Query | Type: PHP
This has to do with creating hierarchical CPTs, so you can have ‘sub-posts’ as children of a CPT single.
CPT, WP/CP | Type: PHP