The monster list of links and code snippets

Originally published: 1st Feb 2021 | Last modified: 8th Jul 2021

I’ve worked on WordPress themes ancient and current, premium and free(mium), but I’m currently handling mostly Divi and Astra projects these days. I keep a file on my desktop with bits and bobs that I reference over and over for different purposesmostly to jog my admittedly poor memory. In the interest of both backing up this file and sharing, here ya go:


25 Useful Tricks for the WordPress Functions File via WP Beginner

Displaying SVG inline via Stackoverflow

A stupidly useful old-school shortcode for getting site title, URL, etc. via CSS Tricks

Tim Whitlock’s tool for getting the unicode value of special characters

Cool stuff it’s safe to do with CSS in 2021 via Smashing Magazine


Gutenberg block filters via WordPress Block Editor Handbook

David Gwyer’s deep dives into manipulating blocks

Passing formatting attributes to block templates in PHP

Accessibility/SEO/Technical SEO

Get help writing image alt text via w3

Simon Hearne on preventing layout shifts with font display

Google’s Structured Data helper tool

Some no-plugin-needed, advanced performance tools for WordPress via GeekFlare

A Stackoverflow conversation about dequeuing specific scripts in WordPress


Divi’s icon font character codes via Divi Dezigns

Responsive type in Divi


Visual Astra theme hooks reference

Exhaustive Astra theme hooks reference

Change Astra’s default breakpoints via WP Astra



/* Enable smooth scrolling natively in CSS */
html {
  scroll-behavior: smooth;
/* (Astra/Gutenberg) specify a custom icon for buttons + read more links that inherits the button text color */
/* .read-more a:after,
.wp-block-button .wp-block-button__link:after {
    content: "[add icon code starting with \]";
    font-family: "Your Icon Font Name";
	margin-left: .5em;
	font-weight: normal;
} */


//For some reason Divi doesn't seem to implement this WP-standard method of adding custom logo support, so if you want to reference the site logo via code anywhere, add the following and make sure the site logo is selected in the Customizer as well as Divi theme options.

add_theme_support( 'custom-logo' );
// Got a shortcode that's dumping content outside the expected container? Might need to buffer it.

function prefix_archive_description_shortcode() {
	// start buffer

	// a function call to something like a template part or category description, gets added to buffered output and doesn't necessarily need to be assigned to a variable.

	// return buffered output
	return ob_get_clean();

add_shortcode('category_description', 'prefix_archive_description_shortcode');

// Read more:
<!-- Show all the files called in a formatted list. -->
    $files = get_included_files();
    var_dump( $files );

// Run a short jQuery script from functions.php
add_action( 'wp_footer', function() {
    // Checks what page you're on before running script
    if( is_page( 'Cart' ) ) { ?>
            ( function( $ ) {
                'use strict';
                $( document ).on( 'ready', function() {

                    // add js or jquery here

                } );
            } ( jQuery ) );
        </script> <?php
} );
// Anything (site name, url, css file path, etc.) that can be accessed via get_bloginfo(). Example shortcodes: [siteinfo key='name'] [siteinfo key='url']

function prefix_bloginfo_shortcode( $atts ) {
       'key' => '',
   ), $atts));
   return get_bloginfo($key);
add_shortcode('siteinfo', 'prefix_bloginfo_shortcode');
// Makes login errors more generic to make life a little harder for would-be hackers
function prefix_no_wordpress_errors(){
  return 'Something is wrong! Please check your login info for errors.';
add_filter( 'login_errors', 'prefix_no_wordpress_errors' );
// Shortcode to output an SVG inline
function prefix_icon_shortcode () {	
	$url = $thefilepath;
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_REFERER, $_SERVER['REQUEST_URI']);
	$svg = curl_exec($ch);

	return $svg;
add_shortcode('custom_icon', 'prefix_icon_shortcode');