Skip to content

Instantly share code, notes, and snippets.

View paulgibbs's full-sized avatar

Paul Wong-Gibbs paulgibbs

View GitHub Profile
$ phpunit
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Installing BuddyPress...
Not running ajax tests... To execute these, use --group ajax.
PHPUnit 3.8-g5efcfe5 by Sebastian Bergmann.
Configuration read from /Users/paul/Sites/example.com/src/wp-content/plugins/buddypress/tests/phpunit.xml
The Xdebug extension is not loaded. No code coverage will be generated.
Reinstates bp_redirect_canonical functionality (#5171)
Improved phpDoc inline documentation (#5022, r7298)
Improved compatibility with develop.svn.wordpress.org unit-test suite (#5200)
<?php
function pg_skip_teachers( $register_events ) {
if ( ! $register_events )
return false;
if ( 'teacher' === get_user_meta( get_current_user_id(), 'usertype', true ) )
return false;
return true;
}
<?php
function alec_redirect() {
if ( is_single() && get_post_type() === 'achievement' ) {
global $wp_query;
$wp_query->set_404();
status_header( 404 );
nocache_headers();
}
}
<?php
libxml_use_internal_errors( true );
$element = simplexml_load_string( $content );
libxml_use_internal_errors( false );
Pauls-MacBook-Air:aargh paul$ grunt build
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object #<Object> has no method 'reduce'
at Object.<anonymous> (/usr/local/lib/node_modules/grunt-cli/node_modules/resolve/lib/core.js:1:103)
at Module._compile (module.js:404:26)
at Object..js (module.js:410:10)
at Module.load (module.js:336:31)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title></title>
</head>
<body>
<table class="dpa-leaderboard-widget">
<caption class="screen-reader-text">
All of the available achievements with the name, avatar, and karma points for each.
</caption>
@paulgibbs
paulgibbs / gist:6138839
Last active January 28, 2018 10:11
add more properties to add-meta-tags properties
<?php
function pg_filter_metatags( $tags ) {
$tags = str_replace( 'meta name="description"', 'meta name="description" itemprop="description"', $tags );
$tags = str_replace( 'meta name="keywords"', 'meta name="keywords" itemprop="keywords"', $tags );
return $tags;
}
add_filter( 'amt_metatags', 'pg_filter_metatags' );
@paulgibbs
paulgibbs / gist:6138834
Created August 2, 2013 10:09
add more properties to add-meta-tags properties
<?php
function pg_filter_metatags( $tags ) {
$tags = str_replace( 'meta name="description"', 'meta name="description" itemprop="description"', $tags );
$tags = str_replace( 'meta name="keywords"', 'meta name="keywords" itemprop="keywords"', $tags );
im($tags);
return $tags;
}
add_filter( 'amt_metatags', 'pg_filter_metatags' );
@paulgibbs
paulgibbs / gist:6108253
Created July 29, 2013 21:59
Rough notes to move achievements from 2.x to 3.x manually
2.x schema => 3.x equivalent:
(direct mapping = you can just copy the value across directly without having to update it)
(I wrote this off the top of my head, so YMMV)
id
action_id => achievement post is now associated with an item in the "dpa_event" taxonomy
picture_id => now uses standard WP 'featured image postmeta key'; "_thumbnail_id". Direct mapping.
action_count => now uses postmeta key; "_dpa_target". Direct mapping.
name => post_title