Skip to content

Instantly share code, notes, and snippets.

@jb510
jb510 / Create WordPress User via PHP
Created August 16, 2013 02:13
Create WordPress User via PHP
<?php
/*
* Create Admin User
*
*/
$jb_password = '__PASSWORD__';
if ( $jb_password === '__PASSWORD__' )
wp_die('FAIL!)';
@jb510
jb510 / Create WP User MySQL
Last active December 21, 2015 04:09
Create WordPress User via MySQL
SET @user_login := '9seedsJB';
SET @user_pass := 'msLsCsVsudvfwgFrMe4e3ejezrZtTyeumuhPv';
SET @user_email := 'jb@9seeds.com';
INSERT INTO `wp_users`
(`user_login`, `user_pass`, `user_email`, `user_registered`)
VALUES
(@user_login, MD5(@user_pass), @user_email, now());
SELECT @user_id := LAST_INSERT_ID();
@jb510
jb510 / dev-functions.php
Created September 13, 2013 23:26
Three functions for manipulating existing WordPress data
<?php
/**
* echo_r function.
*
* Jon's favorite little debug function
*
* @access public
* @param mixed $array
* @return void
*/
@jb510
jb510 / gist:6602791
Created September 18, 2013 00:32
Prefix Post
$rewrite = array (
'slug' => $slug,
'with_front' => false
);
$args = array (
'rewrite' => $rewrite
);
register_post_type( 'post', $args );
@jb510
jb510 / gist:9042626
Created February 17, 2014 00:23
css for chuck burke
@font-face {
font-family: 'playbill';
src: url("customfonts/playbill-webfont.eot");
src: url("customfonts/playbill-webfont.eot?#iefix") format('embedded-opentype'),
url("customfonts/playbill-webfont.woff") format('woff'),
url("customfonts/playbill-webfont.ttf") format('truetype'),
url("customfonts/playbill-webfont.svg#playbillregular") format('svg');*/
font-weight: normal;
font-style: normal;
{
"folders": [{
"follow_symlinks": true,
"path": ".",
}],
"settings": {
"xdebug": {
// Replace {site_name} throughout, your paths may vary depending on our config
"path_mapping": {
"/vagrant/www/{site_name}": "~/VVV/www/{site_name}",
@jb510
jb510 / gist:9999718
Created April 6, 2014 00:09
Don't Update Plugin WordPress API 1.1
/**
* Dont Update the Plugin
* If there is a plugin in the repo with the same name, this prevents WP from prompting an update.
*
* @since 1.0.0
* @author Jon Brown
* @param array $r Existing request arguments
* @param string $url Request URL
* @return array Amended request arguments
*/
@jb510
jb510 / gist:9999721
Created April 6, 2014 00:10
Don't Update Theme WordPress API 1.1
/**
* Don't Update Theme.
*
* If there is a theme in the repo with the same name, this prevents WP from prompting an update.
*
* @since 1.0.0
* @author Mark Jaquith
* @link http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-update-checks/
* @param array $r Existing request arguments
* @param string $url Request URL
@jb510
jb510 / gist:10014524
Created April 7, 2014 03:42
WordPress Shortcode Output Buffer
/**
* Sample Shortcode
* @since 1.0.0
*
* @param null
* @return string Site URL
*/
function jb_sample_shortcode( $atts ) {
ob_start(); ?>
<!-- hello world -->
@jb510
jb510 / gist:67f75dc532c70e790158
Last active August 29, 2015 14:01
Single Page Navigation of grandchildren skipping parents
<?php
function lm_do_video_navigation() {
// This runs on the grandchild. It finds the grandparent, then it's children, and loops through
// the children in order building an array of the grandchildren in menu_order.
// get top parent post ID
$top_parent_ID = get_page(array_pop(get_post_ancestors($post->ID)))->ID;
$args = array(