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 better snippets or references.

Clearfix

Maybe the most widely used clear after float.
CSS | Type: CSS

Compression – wp-config

Enable compression in wp-config /* Compression */ define( 'COMPRESS_CSS', true ); define( 'COMPRESS_SCRIPTS', true ); define( 'ENFORCE_GZIP', true );
wp-config | Type: PHP

Conflicting Scripts

This constant is enabled by default and means that all JavaScript files are loaded with a single call, rather than multiple calls to multiple files (faster [...]
Troubleshooting | Type: Javascript

Connect to Separate Database

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 [...]
DB Query, WP/CP | Type: PHP

COVID-19 Embed JS

  <div class="covid-act-now-embed" /><script src="https://covidactnow.org/scripts/embed.js"></script></div>

CPT to CPT Reverse Query

Reverse query from different post types associated via ACF relationship field.
ACF, CPT, 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