Skip to content

Instantly share code, notes, and snippets.

Alex King alexkingorg

Block or report user

Report or block alexkingorg

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
alexkingorg / wp-anonomize-user-data.sql
Created Oct 6, 2011
Remove non-public user data from standard WP database.
View wp-anonomize-user-data.sql
-- generic email addresses and new passwords for users
UPDATE wp_users
SET user_email = CONCAT(user_login, ''),
user_pass = MD5(CONCAT(RAND(), CAST(ID AS CHAR), user_login));
-- generic email addresses for commentors
UPDATE wp_comments
SET comment_author_email = CONCAT(CAST(comment_ID AS CHAR), '');
alexkingorg / wp-switch-to-post.php
Created Oct 19, 2011
switch_to_post() stack implementation (similar to switch_to_blog()) for WordPress
View wp-switch-to-post.php
$WP_POST_STACK = array();
function switch_to_post($post_id) {
global $WP_POST_STACK, $post;
if (!count($WP_POST_STACK)) {
$WP_POST_STACK[] = $post->ID;
$WP_POST_STACK[] = $post_id;
alexkingorg / wp-plugin-path.php
Created Dec 15, 2011
Defining symlink compatible paths for WordPress plugins
View wp-plugin-path.php
// include this near the top of your plugin file
$my_plugin_file = __FILE__;
if (isset($plugin)) {
$my_plugin_file = $plugin;
else if (isset($mu_plugin)) {
alexkingorg / query_format_standard.php
Created Jan 2, 2012
Enable WP_Query to search by "standard" post format.
View query_format_standard.php
function akv3_query_format_standard($query) {
if (isset($query->query_vars['post_format']) &&
$query->query_vars['post_format'] == 'post-format-standard') {
if (($post_formats = get_theme_support('post-formats')) &&
is_array($post_formats[0]) && count($post_formats[0])) {
$terms = array();
foreach ($post_formats[0] as $format) {
$terms[] = 'post-format-'.$format;
alexkingorg / wp-stats.php
Created Jan 3, 2012
WordPress per-year blog stats
View wp-stats.php
header('Content-type: text/plain');
global $wpdb;
<table class="numbers">
alexkingorg / wp-recent-posts-by-format.php
Created Jan 6, 2012
WordPress Recent Posts by Format Widget
View wp-recent-posts-by-format.php
// relies on
class WP_Widget_Recent_Posts_By_Format extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_recent_entries_by_format', 'description' => __( "The most recent posts on your site by format") );
parent::__construct('recent-posts-by-format', __('Recent Posts by Format'), $widget_ops);
$this->alt_option_name = 'widget_recent_entries_by_format';
View wp-favepersonal-format-image-excerpt-hover.php
// Cut off images at 300px high in excepts, show full image on hover
function akv3_image_excerpt_hover_js() {
;jQuery(function($) {
$('.format-image.excerpt .entry-content').hover(function() {
if ($('body').width() < 768) {
alexkingorg / wp-editor-char-count.php
Created Jan 16, 2012
Character counter for WordPress editor
View wp-editor-char-count.php
// handy if you write status posts and send them to Twitter
function akv3_editor_char_count() {
<script type="text/javascript">
(function($) {
wpCharCount = function(txt) {
$('.char-count').html("" + txt.length);
alexkingorg / style.css
Created Mar 20, 2012 — forked from ejdanderson/style.css
FavePersonal Child Theme style.css
View style.css
Theme Name: FavePersonal Child
Theme URI:
Description: Child theme for the FavePersonal Theme
Author: Your name here
Author URI:
Template: favepersonal
Version: 1.0
alexkingorg / functions.php
Created Mar 20, 2012 — forked from ejdanderson/functions.php
FavePersonal Child Theme functions.php
View functions.php
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die(); }
You can’t perform that action at this time.