Skip to content

Instantly share code, notes, and snippets.

View d4mation's full-sized avatar
😏
GitHub is a social network now

Eric Defore d4mation

😏
GitHub is a social network now
View GitHub Profile
@d4mation
d4mation / eddar-auto-populate.js
Created November 1, 2022 18:50
Populate EDD Advanced Reporting with data for every Download
// Just run this in the console and you're good to go
var firstOption = true;
jQuery( 'select[name="edd_report_series[0][download]"] option' ).each( function( index, option ) {
if ( jQuery( option ).val() == 0 || jQuery( option ).val() == 'all' ) return true;
if ( firstOption ) {
@d4mation
d4mation / managewp-site-exclude.js
Created October 18, 2022 13:48
In the event that you have a site that you don't trust to run through Safe Update in Manage WP, or perhaps a client hasn't entered a service contract yet, you can use this to auto-uncheck updates for them before running updates for your other clients
let excludeSites = [
'urltoexclude.com',
'anotherurltoexclude.com',
];
jQuery( '.updates-container .update-row' ).each( function( index, updatesToggle ) {
if ( ! jQuery( updatesToggle ).hasClass( 'expand' ) ) {
jQuery( updatesToggle ).click();
}
@d4mation
d4mation / KDL-40W580B_getRemoteControllerInfo.json
Created July 5, 2022 15:00
Sony KDL-40W580B getRemoteControllerInfo
{
"id": 10,
"result": [
{
"bundled": true,
"type": "RM-J1100"
},
[
{
"name": "PowerOff",
@d4mation
d4mation / copy-rules.js
Created February 16, 2022 20:23
Copies CSS rules from one selector to another. Useful in cases where you want to snag some already-loaded CSS from code you don't have control over.
/**
* Copies all CSS from one selector to another
* This is done by searching for a selector and then replacing it with another
*
* @param object replacements Selector => Replacement
* @param string stylesheethref Only check Stylesheets with this in its href attribute
*
* @since {{VERSION}}
* @return void
*/
@d4mation
d4mation / update-get-url-parameter.js
Created February 21, 2020 19:53
Easily update/get a URL Parameter via JS. I keep needing this and forget what projects I used it in, so here we go.
/**
* Gets a Value from a Query String by Key
*
* @param {string} queryString Query String
* @param {string} key
*
* @since 1.0.0
* @return {string} Query String
*/
function getURLParam( queryString, key ) {
@d4mation
d4mation / gist:bf267f91c96b85bc6b2a4b6d9f5c0f6f
Last active June 11, 2018 13:00
Multisite Plugin Stats List Per Site
// Multisite Plugin Stats plugin shows a list of sites per Plugin in a Hidden List.
var plugins = [];
jQuery( '.plugin_site_list' ).each( function( index, list ) {
if ( jQuery( list ).find( 'li:contains("SITE NAME")' ).length > 0 ) {
plugins.push( jQuery( list ).prev().text() );
@d4mation
d4mation / non-admin-site-identity-wp.php
Created December 21, 2016 16:13
Grant non-admins Site Identity Options in WordPress
<?php
/**
* Allows certain Customizer Settings to not require `manage_options`
* Since no one wants to give Clients Admin Access if they don't have to.
*
* You will need to grant them `edit_theme_options` for this example, which will also give them access to the Customizer
*/
add_action( 'customize_register', 'add_site_identity_for_non_admins' );
function add_site_identity_for_non_admins( $wp_customize ) {
@d4mation
d4mation / foundation-magellan-scrolling-hash-update.js
Created October 12, 2016 16:16
Zurb's Foundations Magellan feature doesn't have a way to update the URL Hash without altering the History
/*
* Zurb's Foundations Magellan feature doesn't have a way to update the URL Hash without also altering the History
*
* http://foundation.zurb.com/sites/docs/magellan.html#js-options
*/
( function( $ ) {
$( '.magellan' ).on( 'update.zf.magellan', function( event, activeElement ) {
@d4mation
d4mation / wp-import-as-one-user.js
Created September 20, 2016 18:51
Import WP .xml File With ALL Imported Content Assigned to the Same User
// Import a WP .xml File
// Paste into Browser Console when it asks you who to assign different Users' Content to
// Change "75" to the desired User ID
jQuery( 'select[name^="user_map"]' ).each( function( index, element ) {
jQuery( element ).val( 75 );
} );