Skip to content

Instantly share code, notes, and snippets.

View Larceniii's full-sized avatar
💭
Retro Text News

Green Larceniii

💭
Retro Text News
View GitHub Profile
@ethitter
ethitter / gist:4430520
Last active May 31, 2017 16:14
WordPress MU Domain Mapping and the Customizer
Index: domain_mapping.php
===================================================================
--- domain_mapping.php (revision 688919)
+++ domain_mapping.php (working copy)
@@ -685,7 +685,7 @@
}
function redirect_to_mapped_domain() {
- global $current_blog, $wpdb;
+ global $current_blog, $wpdb, $wp_customize;
Index: domain_mapping.php
===================================================================
--- domain_mapping.php (revision 646767)
+++ domain_mapping.php (working copy)
@@ -519,6 +519,10 @@
}
function domain_mapping_siteurl( $setting ) {
+ // Don't redirect customizer requests
+ if ( isset( $_SERVER['HTTP_REFERER'] ) && false !== strpos( $_SERVER['HTTP_REFERER'], 'wp-admin/customize.php' ) )
@franz-josef-kaiser
franz-josef-kaiser / admin_menu_separator.php
Last active September 7, 2020 22:05
WordPress (mu)plugin to add a separator to the admin menu with a call to the default API. Explanation can be found in the doc block. // Screenshots (main menu separator) http://i.stack.imgur.com/HUmKQ.png // (submenu separator) http://i.stack.imgur.com/6AKDY.png
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: Admin Menu Separator
* Description: Adds a separator on whatver priority is needed.
*/
add_filter( 'parent_file', 'admin_menu_separator' );
function admin_menu_separator( $parent_file )
{
@yaph
yaph / ula2json.js
Created October 24, 2013 20:14
Convert an HTML ul list of links to a JSON list of objects with href and text content.
var list = [];
$('ul a').each(function(idx, item){
list.push({
href: $(item).attr('href'),
text: item.textContent
});
});
JSON.stringify(list, null, " ");
@endel
endel / number-pad-zero.js
Last active August 1, 2023 11:54
Simplest way for leading zero padding in JavaScript
Number.prototype.pad = function(size) {
var s = String(this);
while (s.length < (size || 2)) {s = "0" + s;}
return s;
}
(1).pad(3) // => "001"
(10).pad(3) // => "010"
(100).pad(3) // => "100"