Skip to content

Instantly share code, notes, and snippets.

View chrisguitarguy's full-sized avatar

Christopher Davis chrisguitarguy

View GitHub Profile
@chrisguitarguy
chrisguitarguy / wp-remove-dashboard.php
Created November 18, 2011 22:25
Remove all the default WordPress dashboard widgets.
<?php
/*
Plugin Name: Remove Dashboard Meta Boxes
Plugin URI: http://pmg.co/category/wordpress
Description: Removes the default dashboard widgets from the WordPress admin.
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
License: GPL2
*/
@chrisguitarguy
chrisguitarguy / menu-order.php
Created October 20, 2011 15:57
Add menu order to WordPress posts
<?php
/*
Plugin Name: Add Menu Order to Posts
Plugin URI: http://pmg.co/category/wordpress
Description: Adds menu order and template to post types.
Version: n/a
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
*/
@chrisguitarguy
chrisguitarguy / comments-example.php
Created September 21, 2011 21:44
How to add custom fields to WordPress comments
<?php
/*
Plugin Name: Add Extra Comment Fields
Plugin URI: http://pmg.co/category/wordpress
Description: An example of how to add, save and edit extra comment fields in WordPress
Version: n/a
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
License: MIT
*/
@chrisguitarguy
chrisguitarguy / post-editing.php
Created November 4, 2011 04:44
Page by page editting permissions for WordPress
<?php
/*
Plugin Name: Restrict Page Access
Plugin URI: https://gist.github.com/1338673
Description: Allows administrators to give editors permission to edit only certain posts
Author: Christopher Davis
Author URI: http://christopherdavis.me
License: GPL2
*/
@chrisguitarguy
chrisguitarguy / widget-tut.php
Created October 11, 2011 22:18
An example of how to build your own WordPress widget
<?php
/*
Plugin Name: PMG Widget Tututorial
Plugin URI: http://pmg.co/category/wordpress
Description: How to create WordPress Widgets.
Version: 1.0
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
License: GPL2
*/
@chrisguitarguy
chrisguitarguy / nav-menu-shortcode.php
Created July 21, 2012 20:29
Add a WordPress nav menu in content with a shortcode. Helpful for HTML sitemaps and the like
<?php
/*
Plugin Name: Nav Menu Shortcode
Plugin URI: http://christopherdavis.me
Description: Add a shortcode to display a given nav menu
Version: 1.0
Author: Christopher Davis
Author URI: http://christopherdavis.me
License: GPL2
@chrisguitarguy
chrisguitarguy / advanced-cache.php
Created November 3, 2012 04:15
Copied/modified batcache to learn how it worked.
<?php
/**
* Plugin Name: Ratcache
* Description: An advanced caching plugin that uses an external object cache to store full pages.
* Author: Christopher Davis
* Author URI: http://christopherdavis.me
* Version: 0.1
*
* Place this file in your `wp-content` directory and add
* `define('WP_CACHE', true)` to your wp config file.
@chrisguitarguy
chrisguitarguy / EnableSavepointsListener.php
Created August 12, 2015 21:56
Doctrine savepoints in Symfony
<?php
use Doctrine\Common\EventSubscriber;
use Doctrine\DBAL\Events;
use Doctrine\DBAL\Event\ConnectionEventArgs;
final class EnableSavepointsListener implements EventSubscriber
{
/**
* {@inheritdoc}
@chrisguitarguy
chrisguitarguy / wpse-remote-auth.php
Created January 21, 2012 16:51
Check WordPress usernames/passwords remote.
<?php
/*
Plugin Name: Authenticate Users Remotely
Author: Christopher Davis
Author URI: http://www.christopherguitar.net/
License: GPL2
*/
add_filter('xmlrpc_methods', 'wpse39662_add_login_method' );
/**
@chrisguitarguy
chrisguitarguy / server.py
Created October 24, 2011 03:14
Super simple python socket server and HTTP request class.
import socket, traceback
HOST = ''
PORT = 51235
CLRF = '\r\n'
class InvalidRequest(Exception):
pass
class Request(object):