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.

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

CSS Border Radius

Can hardly remember what it was like in the old days when we wanted rounded corners.
CSS3 | Type: CSS

CSS-only Accordians

When javascript doesn’t make the grade. HTML <div class="wrapper">     <div class="half">         <p>Open multiple</p>         <div class="tab"><input id="tab-one" name="tabs" type="checkbox" /> <!--can open several tabs at once-->             <label [...]
CSS, Javascript | Type: CSS

CSS-only Mobile Menu

Mobile menu that doesn't use javascript. Uses hidden checkbox to toggle state.
CSS, Responsive | Type: CSS