A collection of (mostly) WordPress/ClassicPress-related snippets and references I’ve found useful and worth keeping where I can find them.
NOTE: Some of these snippets are old and may be outdated. Feel free to use what you like, and point me to better snippets or references.
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"> [...]
Search | Type: PHP
Search Results on Different Search Template
When you need a custom search 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
Shim Plugin for ACF Pro with ClassicPress
The issue is with the last function in /plugins/advanced-custom-fields-pro/pro/blocks.php, which calls for functions ClassicPress does not have. I put this into an mu-plugin on my WebJournal, [...]
ACF, PHP, WP/CP | Type: PHP
Show Only Posts with a Particular Custom Field Value
You can display only posts that include a particular custom field value. In this example, ‘events’ posts with event_type ‘Workshop’ will be displayed; other event types [...]
WP Query | 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
Sliding Image Background
Cool effect if you have a good enough reason and a wide enough image.
CSS, CSS3, Images | Type: CSS
SmoothScroll to Top
Positions element at top on scrolling using jQuery scrollTop.
Javascript, jQuery | Type: Javascript






