Skip to content

Instantly share code, notes, and snippets.

Avatar
🖖

Ryan Niswonger rniswonger

🖖
View GitHub Profile
@rniswonger
rniswonger / functions.php
Created Jul 13, 2022
WordPress: Restrict the Customizer menu search to titles
View functions.php
/**
* 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;
View simple-encode-email-links--script.php
@rniswonger
rniswonger / wordpress-change-admin-color-scheme-based-on-environment--functions.php
Last active Mar 30, 2022
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.
View wordpress-change-admin-color-scheme-based-on-environment--functions.php
/**
* Change admin color scheme based on environment for a specific user
* Color scheme options: fresh, light, modern, blue, midnight, sunrise, ectoplasm, ocean, coffee
*/
function change_color_scheme() {
$user_ids = array( 1 ); // set your user id or ids here, assuming they do not change across envs
$current_user_id = get_current_user_id();
// configure the environment addresses and their color schemes
$environments = array(
@rniswonger
rniswonger / fix-gmail-width--bookmarklet.js
Last active Mar 30, 2022
A bookmarklet that resize's image and table content in Gmail messages to prevent horizontal scrolling.
View fix-gmail-width--bookmarklet.js
javascript:(()=>{ document.querySelectorAll('.a3s table').forEach(item=>{item.style.width="90%"; }); document.querySelectorAll('.a3s img').forEach(item=>{item.style.maxWidth="90%";item.style.height="auto"; }); })();
@rniswonger
rniswonger / functions.php
Last active Mar 27, 2021
Gravity Forms: Replace the submit <input> with a <button>
View functions.php
/**
* 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 Oct 28, 2020
Avada Theme: Equal height Content Boxes
View custom.css
/*
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;
@rniswonger
rniswonger / copy-me-into-the-css-editor.css
Last active May 28, 2020
boardgameareana.com - Dark theme (WIP)
View copy-me-into-the-css-editor.css
/*
# To do:
* Chat windows
* Settings page
* ... probably a lot more
# Note:
After saving the custom CSS in BGA, the format of this code will be altered
and these comments will be removed. This is expected.
Also, some games define their own colors which will cause some contrast issues.
*/
@rniswonger
rniswonger / 7zip-all-subfolders.bat
Created Nov 9, 2019
Use 7zip to archive all subfolders in their own zip file
View 7zip-all-subfolders.bat
for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.zip" "%%X\"