Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en-US" prefix="og: http://ogp.me/ns#">
<head>
<meta charset="UTF-8">
<title>JS Driven Weather View</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script src="https://raw.github.com/andris9/jStorage/master/jstorage.js"></script>
<?php
add_action( 'do_meta_boxes', function() {
global $pagenow;
if( 'edit.php' != $pagenow ) {
// Only show on edit.php page
return;
}
@blobaugh
blobaugh / gist:f60fb50838edabd49159
Created February 14, 2015 19:58
WCMaui Code Demo
add_filter( 'the_content', function( $content ) {
$response = wp_remote_get( 'http://ben.lobaugh.net/wp-json/posts' );
if( '200' == wp_remote_retrieve_response_code( $response ) ) {
$posts = json_decode( wp_remote_retrieve_body( $response ) );
foreach( $posts AS $p ) {
echo $p->title->rendered . "<br/>";
@blobaugh
blobaugh / install.php
Last active September 27, 2023 19:03
WordPress auto-activate plugins script
<?php
/*
* wp-content/install.php
*
* This file runs automatically when the WordPress installer is run.
* Most WordPress functionality will be available to provide the ability
* to perform any additional actions on installation you would like.
*/
@blobaugh
blobaugh / gist:9995104
Created April 5, 2014 17:31
WordPress Plugin Handbook Revision update
Missing from the Plugin Handbook
These are notes of things from the new plugin handbook that are either currently missing or that need some serious updating.
Section 1 - Intro to Plugin Dev
How do plugins work
What is a plugin - Just sounds cheesy, and it is inaccurate on what a plugin needs. See 2. Plugin Basics
Section 2 - Plugin Basics
Activation/Deactivation hooks
@blobaugh
blobaugh / gist:9900488
Created March 31, 2014 19:39
March 2014 .vimrc
syntax on
set number
set linebreak
set showbreak=+++
set textwidth=0
set showmatch
set visualbell
set hlsearch
set smartcase
set ignorecase
@blobaugh
blobaugh / gist:8875679
Created February 8, 2014 02:19
Bad php
<?php
echo $bob['thisisbad'];
@blobaugh
blobaugh / gist:7977545
Created December 15, 2013 20:13
server from wpcom
<?php
/*
Plugin Name: Serve from WordPress.com
Plugin URI: http://github.com/blobaugh/serve-from-wordpress-com
Description: Switches the URL on built-in WordPress javascript files to serve from WordPress.com rather than locally
Author: Ben Lobaugh
Version: 0.6
Author URI: http://ben.lobaugh.net
*/
@blobaugh
blobaugh / gist:7223022
Created October 29, 2013 21:32
Add additional support for Infinite Scroll in Jetpack
function tweakjp_custom_is_support() {
$supported = current_theme_supports( 'infinite-scroll' ) && ( is_home() || is_archive() || is_search() );
return $supported;
}
add_filter( 'infinite_scroll_archive_supported', 'tweakjp_custom_is_support' );
@blobaugh
blobaugh / gist:6330219
Created August 24, 2013 20:21
Add custom post type to Jetpack
function tweakjp_allow_cpt( $allowed_post_types ) {
// my_cpt is the name of your <span class="hilite">Custom</span> <span class="hilite">Post</span> <span class="hilite">Type</span>
$allowed_post_types[] = 'my_cpt';
return $allowed_post_types;
}
add_filter( 'rest_api_allowed_post_types', 'tweakjp_allow_cpt' );