Skip to content

Instantly share code, notes, and snippets.

View rniswonger's full-sized avatar
🖖

Ryan Niswonger rniswonger

🖖
View GitHub Profile
@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 / wordpress-add-columns-to-post-list--functions.php
Last active March 30, 2022 17:49
WordPress: Add admin columns for a custom post type
<?php
/**
* CPT: Custom columns for post_slug
* replace all occurances of "post_slug" with your post type's slug and "theme_domain" with your theme's domain
*/
function set_custom_edit_post_slug_columns( $columns ) {
// unset( $columns['date'] ); // disable existing column
$columns['image'] = __( 'Image', 'theme_domain' );
$columns['date'] = __( 'Custom Date', 'theme_domain' );
@rniswonger
rniswonger / custom-post-type-ui--auto-export--functions.php
Last active March 30, 2022 17:39
WordPress: Export into theme all "Custom Post Type UI" post types and taxonomies
/**
* Saves post type and taxonomy data to JSON files in the theme directory.
* @param array $data Array of post type data that was just saved.
* Code originally provided by the author of the plugin
*/
function cptui_local_json( $data = array() ) {
$theme_dir = get_stylesheet_directory();
// Create our directory if it doesn't exist
if ( ! is_dir( $theme_dir .= '/cptui-json' ) ) {
mkdir( $theme_dir );
@rniswonger
rniswonger / simple-encode-email-links--script.php
Last active March 30, 2022 17:36
PHP + JS email obfuscation
@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 / copy-me-into-the-css-editor.css
Last active May 28, 2020 04:32
boardgameareana.com - Dark theme (WIP)
/*
# 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 / adobe-hd-fix.reg
Created October 9, 2019 16:43
Fix Adobe CS5 Photoshop and Illustrator scaling issues in Windows 10
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide]
"PreferExternalManifest"=dword:00000001
@rniswonger
rniswonger / nextdoor-bookmarklet.js
Created October 9, 2017 21:25
Bookmarklet: Hide annoying content on NextDoor
javascript:$('.content-scope-line:contains("Classifieds")').parents('.post-container').hide();$('.classifieds-single-item-content').hide();$('.content-scope-line:contains("Free items")').parents('.post-container').hide();$('.content-scope-line:contains("Recommendations")').parents('.post-container').hide();$('.content-scope-line:contains("Lost & Found")').parents('.post-container').hide();$('.post-byline:contains("Sponsored")').parents('.post-container').hide();