Skip to content

Instantly share code, notes, and snippets.

Avatar

Frankie Jarrett fjarrett

View GitHub Profile
@fjarrett
fjarrett / gist:2ecec35b53641e672743
Last active Aug 29, 2015
Custom user registration process
View gist:2ecec35b53641e672743
<?php
/**
* Process user registration
*
* A custom user registration process that listens for a
* specific type POST request that will create a new user
* on the blog.
*
* @action wp
@fjarrett
fjarrett / gist:4887016fd3f69463ccb5
Created Dec 18, 2014
Custom user registration jQuery
View gist:4887016fd3f69463ccb5
/* globals fjarrett */
jQuery( function( $ ) {
$( document ).on( 'click', 'form #submit-registration', function (e) {
$.ajax({
type: 'POST',
url: fjarrett.ajaxurl,
data: {
action: 'fjarrett_user_registration',
registration_token: $( '#registration_token' ).val(),
@fjarrett
fjarrett / gist:be5423e0899895558d75
Last active Aug 29, 2015
Delete unwanted Stream Notification Rule post meta from other post types
View gist:be5423e0899895558d75
<?php
function wp_stream_scrub_notification_rule_post_meta() {
$post_types = get_post_types( array(), 'names' );
unset( $post_types['stream_notification'] );
$args = array(
'post_type' => $post_types,
'post_status' => 'any',
View gist:1334474ad5ae7a71ad33
Verifying that +fjarrett is my openname (Bitcoin username). https://onename.com/fjarrett
@fjarrett
fjarrett / gist:83c2698ea83ca7381ff8
Last active Aug 29, 2015
Testing the output of PHP microtime()
View gist:83c2698ea83ca7381ff8
<?php
echo '<h1>Current Time</h1>';
$microtime = microtime( true );
printf( '<p><strong>Unix epoch microtime:</strong> %s</p>', $microtime );
printf( '<p><strong>GMT/UTC timezeone:</strong> %s</p>', date( 'Y-m-d H:i:s', $microtime ) );
@fjarrett
fjarrett / Post_Type.php
Last active Aug 29, 2015
Register post type helper class
View Post_Type.php
<?php
///////////////////////////////////////////////////////////////////////////////////
// Please use within a namespace, or change this helper class name. //
// Don't forget to properly prefix the apply_filters() calls made throughout. //
// //
// Example usage: //
// //
// new Post_Type( 'book', 'Book', 'Books' ); //
// new Post_Type( 'video', 'Video', 'Videos', array( 'has_archive' => false ) ); //
@fjarrett
fjarrett / wp-bulk-update-core.sh
Last active Sep 12, 2015
Update core on every virtual host running WordPress
View wp-bulk-update-core.sh
#!/bin/bash
for DIR in /var/www/*/public_html; do
cd $DIR
if [ -f "wp-config.php" ]; then
echo "cd $DIR"
@fjarrett
fjarrett / wp-bulk-update-themes.sh
Last active Sep 12, 2015
Update all themes on every virtual host running WordPress
View wp-bulk-update-themes.sh
#!/bin/bash
for DIR in /var/www/*/public_html; do
cd $DIR
if [ -f "wp-config.php" ]; then
echo "cd $DIR"
@fjarrett
fjarrett / wp-bulk-update-plugins.sh
Last active Sep 12, 2015
Update all plugins on every virtual host running WordPress
View wp-bulk-update-plugins.sh
#!/bin/bash
for DIR in /var/www/*/public_html; do
cd $DIR
if [ -f "wp-config.php" ]; then
echo "cd $DIR"
@fjarrett
fjarrett / gist:8cd04bd33e49bbd6e3b7
Last active Sep 19, 2015
Force WP JSON REST API endpoints to always be served over HTTPS
View gist:8cd04bd33e49bbd6e3b7
<?php
/**
* Force WP JSON REST API endpoints to always be served over HTTPS
*
* @action wp_json_server_before_serve
*
* @return void
*/
function fjarrett_wp_json_force_ssl() {