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.
Responsive Tabs to Accordian»
At chosen break point, tabs become an accordian.
CSS, Responsive | Type: Javascript
Responsive Video Embeds»
One of the ways to make video pasted into the editor responsive.
Responsive | Type: PHP
Restore Gravity Forms Embed Button on TinyMCE»
Add to theme functions file. Displays on every WYSIWYG field /*****Restore Gravity Forms Embed Button on TinyMCE*********/ add_filter( 'gform_display_add_form_button', '__return_true' ); More examples on GF Docs
Forms, TinyMCE | Type: PHP
Saving ACF Options Field results in 404»
Temporarily disable ModSecurity (cPanel) and save the field. Once the option field is saved, you should re-enable ModSecurity!!!
ACF | Type: PHP
Search Form for CPT»
To add a search form that searches only a particular post type, not your entire website. <form id="cptsearch" action="<?php echo home_url(); ?>" method="get"> <input name="s" type="text"> <input name="post_type" type="hidden" value="POSTTYPENAME">…
Search | Type: PHP
Search Results on Which Template»
When you need a custom results template for a CPT.
Search | Type: PHP
Self-clearing Floats (Dan Cederholm)»
Clears items following floated objects.
CSS | Type: CSS
Set Cookie, Change Content (or change class)»
Using a cookie to change content for repeat visits.
Cookies, CSS, PHP | Type: PHP
Show remaining entries on Gravity Forms registration form»
Displays number of entries remaining for a particular form in a shortcode
Forms | Type: PHP
Show/hide text with row truncate (CSS only)»
This avoids the mid-word break of the other show/hide snippet by selecting number of rows to show.
CSS | Type: CSS