This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Alloptions Optimizer | |
* Author: Mark Jaquith | |
*/ | |
class AllOptionsOptimizer { | |
private static $usedOptions = []; | |
private static $allOptions = []; | |
private static $allOptionsBytes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
function maybeBail() { | |
if [[ $? -ne 0 ]]; then | |
exit 1 | |
fi | |
} | |
TYPE=$(gum choose "fix" "feat" "docs" "style" "refactor" "test" "chore" "revert") | |
maybeBail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Open Admin Links in New Tab | |
* Author: Mark Jaquith | |
*/ | |
add_action('admin_footer', function () { | |
echo <<<SCRIPT | |
<script> | |
document.body.addEventListener('click', (e) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Disable plugins when doing local dev | |
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify | |
Version: 0.1 | |
License: GPL version 2 or any later version | |
Author: Mark Jaquith | |
Author URI: http://coveredwebservices.com/ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Change /*CUSTOMIZE_THIS*/ to a unique name (two places). Go ahead, make it long. | |
// Like, your initials, and your full plugin name. | |
// e.g. MTJ_Some_Awesome_Plugin_Controller | |
/*CUSTOMIZE_THIS*/_Controller::init(); | |
class /*CUSTOMIZE_THIS*/_Controller { | |
function init() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo xcodebuild -license | |
xcode-select --install # There will be a GUI prompt | |
sudo cpan SVN::Core # use the "sudo" method when prompted | |
# Then add this to your ~/.profile: | |
# export PATH=/Library/Developer/CommandLineTools/usr/bin:$PATH | |
# Then probably: | |
brew reinstall git | |
brew reinstall subversion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Usage: | |
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL | |
if ( !$frag->output() ) { // NOTE, testing for a return of false | |
functions_that_do_stuff_live(); | |
these_should_echo(); | |
// IMPORTANT | |
$frag->store(); | |
// YOU CANNOT FORGET THIS. If you do, the site will break. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PLUGINS=$(wp plugin list --update=available --field=name | tr -d '\r'); | |
wp plugin update-all; | |
for plugin in $PLUGINS; do | |
git add -A "wp-content/plugins/$plugin"; | |
git commit -m "Update plugin: $plugin"; | |
done; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function home_page_first_last_name_redirect() { | |
if ( is_front_page() && is_user_logged_in() && ! isset( $_GET['firstName'] ) ) { | |
$user = wp_get_current_user(); | |
$url = add_query_arg( array( | |
'firstName' => $user->first_name, | |
'lastName' => $user->last_name, | |
)); | |
wp_redirect( $url ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: YOUR PLUGIN NAME | |
*/ | |
include( dirname( __FILE__ ) . '/lib/requirements-check.php' ); | |
$your_plugin_requirements_check = new YOUR_PREFIX_Requirements_Check( array( | |
'title' => 'YOUR PLUGIN NAME', | |
'php' => '5.4', |