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.
Disallow Indexing of PDFs in Media
Important if PDFs are only available behind login or downloadable after transaction.
¡Important!, eCommerce, WP/CP | Type: Other
Display Dates if Start and End Dates Same Month
Handy snippet for displaying event dates when events can stretch over multiple days.
ACF, Date/Time, PHP | Type: PHP
Display Debugging status on Admin Bar
Code shared by CodePotent; goes in your theme functions file. function codepotent_debug_notifier_register_admin_bar() { if (!current_user_can('manage_options')) { return; } global $wp_admin_bar; $label = esc_html__(' Debugging DISABLED ', 'codepotent-debug-notifier'); if [...]
WP/CP | Type: PHP
Display Featured Image on Listing
How to add featured image to other post types. ADD TO THEME FUNCTIONS // This theme uses post thumbnails add_theme_support( 'post-thumbnails', array( 'plans','listings','news','post' ) ); ON [...]
Images, PHP, WP/CP | Type: PHP
Display the Title for the Posts / Blog Page
You can’t use the standard the_title(); template tag for the page name of the page that displays the blog listing (index.php); that tag will display the [...]
PHP, Template Tags, WP/CP | Type: PHP
Divs Same Height
Make divs in a container equal heights.
Javascript, jQuery | Type: Javascript
Eliminate Blue Outline on PopupMaker Content
.popmake-content { outline:none!important; }
CSS | Type: CSS
Eliminate Caching on Specific Page Templates and Post Types
Put in your theme’s header.php file: <?php if (is_page_template('page_eventslist.php')) { //conditional, if desired header('Cache-Control: no-cache, no-store, must-revalidate'); header('Pragma: no-cache'); [...]
CPT, WP/CP | Type: PHP
Embed Responsive YouTube Videos
First, the CSS: .youtube-video { aspect-ratio: 16 / 9; width: 100%; } Then add the class to the iframe embed code: <iframe class="youtube-video" src="https://www.youtube.com/embed/xxxxxx" title="YouTube video [...]
CSS, Responsive, Video | Type: CSS
End of Text characters, u0003, aka ‘mystery characters’
Apparently, there can be a mismatch of encoding after a db update by your webhost, and it can result in odd characters appearing in text. This [...]
wp-config | Type: Other






