Skip to content

Instantly share code, notes, and snippets.

View aprea's full-sized avatar
💯

Chris Aprea aprea

💯
  • Sydney, Australia
View GitHub Profile
@aprea
aprea / gist:9678766
Created March 21, 2014 03:12
Generate dummy WordPress posts
<?php
// Generates a SQL dump that imports a number of posts into the wp_posts table
set_time_limit(0);
$table_prefix = 'wp_';
$max_posts = 50000;
$max_inserts_per_query = 50;
$file = dirname( __FILE__ ) . '/dump.sql';
@aprea
aprea / Basic Dummy Comments
Last active August 29, 2015 13:56
A small WordPress plugin to create a bunch of dummy comments for a specified post
<?php
/*
Plugin Name: Basic Dummy Comments
Version: 0.1
Plugin URI: https://github.com/aprea
Description: Creates a bunch of dummy comments
Author: Chris Aprea
Author URI: https://gist.github.com/aprea/9344578
License: GPL v3
@aprea
aprea / gist:4209748
Created December 4, 2012 22:44
Get all DB tables from a WordPress database installation
function reset_array( &$value, $key ) {
$value = $value[0];
}
function get_tables() {
global $wpdb;
$results = $wpdb->get_results( 'show tables from ' . DB_NAME, ARRAY_N );
array_walk( $results, 'reset_array' );
return $results;
}
@aprea
aprea / gist:4029130
Created November 7, 2012 02:02
Clean WordPress logged in message
<?php printf( 'User is%s logged in.', ( is_user_logged_in() ? '' : ' not' ) ); ?>