Skip to content

Instantly share code, notes, and snippets.

Robert O'Rourke roborourke

Block or report user

Report or block roborourke

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@roborourke
roborourke / wp-react-dev.php
Last active Jun 4, 2019
Get the development version of react in WordPress without needing a dev version of WP
View wp-react-dev.php
<?php
/**
* Enable dev mode vendor packages.
*/
if ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) {
return;
}
add_action( 'init', function () {
@roborourke
roborourke / gutenberg-frontend-columns.php
Last active Jun 5, 2018
Fixes markup for <InnerBlocks.Content/> output
View gutenberg-frontend-columns.php
<?php
add_filter( 'the_content', function ( $content ) {
// Fix layouts HTML.
libxml_use_internal_errors( true );
$dom = new \DOMDocument( '1.0', 'UTF-8' );
$dom->loadHTML( utf8_decode( $content ) );
$xpath = new \DOMXPath( $dom );
@roborourke
roborourke / nf-gtm.js
Last active Jul 27, 2018
Ninja Forms Google Tag Manager Trigger
View nf-gtm.js
<script>
jQuery( document ).on( 'nfFormReady', function() {
nfRadio.channel('forms').on('submit:response', function(form) {
window.dataLayer = window.dataLayer||[];
dataLayer.push({
event: 'ninjaFormSubmission',
eventData: form.data,
formID: form.data.form_id,
formTitle: form.data.settings.title
})
View .kbaliases
### Keybase ###
function pb() {
echo "$@" | pbcopy
}
# Usage: kbm 'message' <usernames...>
alias kbm='pb keybase encrypt -m'
@roborourke
roborourke / ms-remove-permalink-blog-slug.php
Created May 12, 2015
Remove /blog slug from permalinks on WordPress multisite
View ms-remove-permalink-blog-slug.php
@roborourke
roborourke / keybase.md
Last active Jul 20, 2016
Keybase verification
View keybase.md

Keybase proof

I hereby claim:

  • I am roborourke on github.
  • I am robo (https://keybase.io/robo) on keybase.
  • I have a public key whose fingerprint is 779C 084C 30CA 91E6 4B0C 9242 ED5B EDB9 0BBA 458F

To claim this, I am signing this object:

@roborourke
roborourke / wp-sslverify-hack.php
Created Apr 11, 2015
Hack to work with external APIs that require ssl verification on a local install of WordPress
View wp-sslverify-hack.php
<?php
// include the following in your wp-config.php or any file that is run before WP is loaded
global $wp_filter;
function hm_kill_sslverify( $args, $url ) {
$args['sslverify'] = false;
@roborourke
roborourke / strptime.php
Created Apr 9, 2015
strptime issue 5.5 problem
View strptime.php
<?php
setlocale( LC_TIME, 'fr_FR' );
$date = strptime( '03 juin 2015 00:00:00', '%d %B %Y %H:%M:%S' );
$time = mktime( 0, 0, 0, $date['tm_mon'] + 1, $date['tm_mday'], $date['tm_year'] + 1900 );
var_dump( $date, $time, date( 'Y-m-d H:i:s', $time ) );
// on 5.5 returns false, 0, 1970-etc...
// on 5.6 returns array(), NNNNNNNNNN, 2015-06-03 00:00:00
// halps
@roborourke
roborourke / featured-external-image.php
Created Mar 20, 2015
Use any linked image in WordPress post content as a featured image
View featured-external-image.php
@roborourke
roborourke / pantheon-wp-multisite.php
Last active Mar 25, 2017
Get subfolder multisite wordpress to work on getpantheon.com hosting
View pantheon-wp-multisite.php
<?php
// hack to make pantheon work with subdirectory multisite
add_action( 'wpmu_new_blog', function( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
if ( defined( 'SUBDOMAIN_INSTALL' ) && ! SUBDOMAIN_INSTALL ) {
$abspath = untrailingslashit( ABSPATH );
$subpath = $abspath . untrailingslashit( $subpath );
if ( ! is_dir( $path ) )
You can’t perform that action at this time.