Skip to content

Instantly share code, notes, and snippets.

View rniswonger's full-sized avatar
🖖

Ryan Niswonger rniswonger

🖖
View GitHub Profile
@rniswonger
rniswonger / index.html
Created November 4, 2022 16:25
HTML: Accessible title with subtitle(s)
<!-- From https://www.tpgi.com/subheadings-subtitles-alternative-titles-and-taglines-in-html/ -->
<hgroup role="group" aria-roledescription="Heading group">
<p aria-roledescription="subtitle">Subtitle 1</p>
<h1>Title</h1>
<p aria-roledescription="subtitle">Subtitle 2</p>
</hgroup>
@rniswonger
rniswonger / functions.php
Last active September 20, 2022 17:50
WordPress: A Better Admin Bar - hide the admin bar in desktop behind a tab and reveal on hover/focus
add_action( 'after_setup_theme', function() {
// remove admin bar margin
add_theme_support( 'admin-bar', array( 'callback' => '__return_false' ) );
} );
@rniswonger
rniswonger / functions.php
Created July 13, 2022 16:51
WordPress: Restrict the Customizer menu search to titles
/**
* Restrict Customizer menu search to titles
* Based on: https://stackoverflow.com/questions/54155517/how-to-limit-wp-admin-to-search-only-titles
* Added Customizer screen detection
*/
add_filter(
'posts_search',
function( $search, $wp_query ) {
global $wp_customize;
global $wpdb;
@rniswonger
rniswonger / simple-encode-email-links--script.php
Last active March 30, 2022 17:36
PHP + JS email obfuscation
@rniswonger
rniswonger / wordpress-change-admin-color-scheme-based-on-environment--functions.php
Last active July 21, 2023 17:45
WordPress: Change admin color scheme based on environment and user. Because I got tired of doing it manually when I re-cloned my local/staging db.
/**
* Change admin color scheme for specific users based on the environment type. Overrides user selection.
* Color scheme options: fresh, light, modern, blue, midnight, sunrise, ectoplasm, ocean, coffee
*/
add_filter(
'admin_init',
function () {
$user_ids = array( 1 ); // Array of user IDs
$current_user_id = get_current_user_id();
@rniswonger
rniswonger / bookmarklet-fix-gmail-desktop-annoyances.js
Last active August 24, 2023 16:47
A bookmarklet that resizes image and table content in Gmail messages to prevent horizontal scrolling.
javascript: (() => { let style = document.createElement("style"); style.innerHTML = ` .a3s table { width: 90% !important; } .a3s img { max-width: 90% !important; height: auto !important; } tr:has(.ast) { display: none !important; } `; document.head.appendChild(style);})();
@rniswonger
rniswonger / functions.php
Last active March 27, 2021 19:03
Gravity Forms: Replace the submit <input> with a <button>
/**
* Gravity Forms: Filters the submit button.
* Replaces the <input> button with a <button> while maintaining attributes from original <input>.
*
* @param string $button Contains the <input> tag to be filtered.
* @param object $form Contains all the properties of the current form.
*
* @return string The filtered button.
*
* GF provides sample code for doing this under Examples at the following link but this dodn't work in my environment.
@rniswonger
rniswonger / custom.css
Created October 28, 2020 22:54
Avada Theme: Equal height Content Boxes
/*
Add this code to the Avada Custom CSS.
Add the class "equal-height" to your Content Boxes Options container, not a single Content Box.
The editor preview will not show the change but reload the live page to see the results.
*/
.fusion-content-boxes.equal-height {
display: flex;
align-items: stretch;
flex-wrap: wrap;