Skip to content

Instantly share code, notes, and snippets.

@JRMorris77
JRMorris77 / 0_reuse_code.js
Created December 12, 2016 08:50
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
// Reduce Snapshot Table Query Chunks
define('SNAPSHOT_TABLESET_CHUNK_SIZE', 100);
// Reduce Snapshot File Chunks
define('SNAPSHOT_FILESET_CHUNK_SIZE', 10);
// DEV Plugins w/o DEV Dashboard
define( 'WPMUDEV_APIKEY', 'YOUR-API-KEY');
//Enable conditional debug mode in wordpress:
<!DOCTYPE html>
<head>
<title>Info</title>
<style type="text/css" media="screen">
body{
margin:0;
padding:0;
text-align:left;
}
.info {
<?php
/*
Plugin Name: Simple Login Redirect
Plugin URI: https://premium.wpmudev.org/support/
Description: A simple mu-plugin that redirects users to their subsite on login.
Version: 0.0.1
Author: James Morris - WPMU DEV
Author URI: https://premium.wpmudev.org/profile/jrmorris77
Network: true
*/
<?php
// This changes the color of the login page
function hook_css() {
?>
<style>
body.login {
background: #006699;
}
</style>
<?php
<?php
add_action('admin_head', 'disable_notice');
function disable_notice() {
echo '<style>
.wp-core-ui .notice.is-dismissible {
display: none;
}
</style>';
}
<?php
if (isDEVAvailible('http://premium.wpmudev.org'))
{
echo "<h1>premium.wpmudev.org is Up and running!</h1>";
}
else
{
echo "<h1>Woops, nothing found at premium.wpmudev.org.</h1>";
}
<?php
/*
Plugin Name: Remove WordPress Admin Menu
Plugin URI: https://premium.wpmudev.org/support/
Description: A simple mu-plugin that removes the WordPress menu from the Admin menu.
Version: 0.0.1
Author: James Morris - WPMU DEV
Author URI: https://premium.wpmudev.org/profile/jrmorris77
Network: true
*/
<script>
//Add HTML elements around text strings inside of a parent element.
jQuery("div.feature-text:contains('products')").html(function(_, html) {
return html.split('products').join("<a class='a'>products</a>");
});
jQuery("div.feature-text:contains('100')").html(function(_, html) {
return html.split('100').join("<a class='b'>100</a>");
});
</script>
@JRMorris77
JRMorris77 / geotag-wp.php
Created October 18, 2017 03:27
Change Geotagging limit from hard set 6 to unlimited in WPMU DEV Google Maps Add-on
<?php
/*
Plugin Name: Geotag my posts
Description: Allows you to add location context to your posts, pages or custom post types.<br />Activate the Add-on and then select which post-types you want to geotag. After this you will find a new metabox in the post editor where you can enter an address. <br>To display a map with all geo-tagged posts use the shortcode <code>[agm_gwp_geocoded_posts]</code>
Example: [agm_gwp_geocoded_posts]
Plugin URI: http://premium.wpmudev.org/project/wordpress-google-maps-plugin
Version: 1.0
Author: Ve Bailovity (Incsub)
*/