Skip to content

Instantly share code, notes, and snippets.

@lukecarbis
lukecarbis / gist:c8770e1a0b4248a2dbf7
Last active August 29, 2015 14:02 — forked from galbaras/gist:6ad566fa9fd7dd8de1d5
WooCommerce Yoast SEO noindex rule
function woo_seo_noindex_special_pages () {
global $post;
$woocommerce_pages = array(
wc_get_page_id( 'myaccount' ),
wc_get_page_id( 'edit_address' ),
wc_get_page_id( 'cart' ),
wc_get_page_id( 'checkout' ),
wc_get_page_id( 'pay' ),
wc_get_page_id( 'view_order' ),
@lukecarbis
lukecarbis / keybase.md
Created August 4, 2014 02:04
keybase.md

Keybase proof

I hereby claim:

  • I am lukecarbis on github.
  • I am carbis (https://keybase.io/carbis) on keybase.
  • I have a public key whose fingerprint is 7141 CB20 2C11 E5A7 1548 0949 1B55 2CC5 E5D8 79D0

To claim this, I am signing this object:

@lukecarbis
lukecarbis / slack-mp6-default.txt
Last active August 29, 2015 14:08
WordPress Admin MP6 Default Slack Theme
#222222,#333333,#0074A2,#FFFFFF,#333333,#FFFFFF,#2EA2CC,#D54E21
@lukecarbis
lukecarbis / slack-mp6-midnight.txt
Created October 27, 2014 19:59
WordPress Admin MP6 Midnight Slack Theme
#363B3F,#25282B,#E14D43,#FFFFFF,#25282B,#FFFFFF,#69A8BB,#69A8BB
@lukecarbis
lukecarbis / frontend-ajax.php
Created October 28, 2014 19:23
WordPress AJAX Frontend Execution
<?php
/**
* WordPress AJAX Frontend Execution.
*
* Using WP Ajax should not be used from the frontend because response
* from `admin-ajax.php` are not cached (including `nocache_headers()`).
* Instead, you should add a query var, and then do the `template_include`
* routine to select a template that returns JSON.
*
* A side benefit here is that it makes your site more RESTful.
if [ $(id -u) -eq 0 ]; then
export PS1="\[$txtred\]\u\[$txrrst\] \W \[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "
else
export PS1="\W \[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "
fi
@lukecarbis
lukecarbis / wpcom-global-terms-fix.php
Created April 29, 2015 11:14
Fix for wp_sitecategories doesn't exist in VIP Quickstart
<?php
// @see https://github.com/Automattic/vip-quickstart/issues/345
add_action( 'vip_loaded', function() {
$is_production = ( defined( '\WPCOM_IS_VIP_ENV' ) && \WPCOM_IS_VIP_ENV );
if ( ! $is_production ) {
wpcom_vip_disable_global_terms();
}
} );
public function callback_set_user_role( $user_id, $new_role, $old_roles ) {
if ( empty( $old_roles ) ) {
return;
}
$old_roles = array_values( $old_roles );
global $wp_roles;
$this->log(
@lukecarbis
lukecarbis / wp-setup.sh
Last active October 17, 2017 20:42
Setup script for a new WordPress site
#!/bin/bash
wp plugin install jetpack theme-check user-switching gutenberg
wp plugin install akismet debug-bar stream --activate
wp core update
wp plugin update --all
wp theme update --all
wp comment delete 1
wp post delete 1
wp post delete 2
wp rewrite structure '/%postname%/'
<?php
$weightings_file = 'https://raw.githubusercontent.com/xwp/wp-tide/develop/services/audit-server/audit-weightings/phpcs/tide/weightings.json';
$markdown_file = 'weightings.md';
if ( isset( $argv[1] ) ) {
$weightings_file = $argv[1];
}
if ( isset( $argv[2] ) ) {
$markdown_file = $argv[2];