Skip to content

Instantly share code, notes, and snippets.

View jazzsequence's full-sized avatar
🚀
Hacking, probably.

Chris Reynolds jazzsequence

🚀
Hacking, probably.
View GitHub Profile
@jazzsequence
jazzsequence / add_unfiltered_html_to_editors.php
Last active March 19, 2024 01:25
Add `unfiltered_html` capability to editors on multisite.
<?php
/**
* Add `unfiltered_html` capability to editors (or other user roles).
* On WordPress multisite, `unfiltered_html` is blocked for everyone but super admins. This gives that cap back to editors
* and above.
*
* @author Justin Tadlock
* @link http://themehybrid.com/board/topics/add-unfiltered_html-capability-to-editor-role#post-4629
* @param array $caps An array of capabilities.
* @param string $cap The capability being requested.
@jazzsequence
jazzsequence / cmb2_version.php
Created November 9, 2016 16:41
output cmb2 version and path
<?php
add_filter( 'cmb2_meta_box_url', function( $cmb2_url, $cmb2_version ) {
wp_die( '<xmp>'. __LINE__ .') '. print_r( get_defined_vars(), true ) .'</xmp>' );
}, 10, 2 );
@jazzsequence
jazzsequence / functions
Created October 12, 2016 20:55
oh my zsh custom functions
function sproj() {
project="${PWD##*/}"
echo "{
\"folders\":
[
{
\"name\": \"mu-plugins\",
\"path\": \"/Applications/MAMP/htdocs/$project/wp-content/mu-plugins\"
},
@jazzsequence
jazzsequence / enqueue_scripts.php
Last active September 19, 2016 19:00
A better way to handle minified js files in WordPress.
<?php
function enqueue_scripts() {
// Don't load these scripts in the admin.
if ( is_admin() ) {
return;
}
$min = '.min';
// A better way to figure out the .min thing...
@jazzsequence
jazzsequence / wds-javascript-style.js
Last active August 29, 2016 18:42 — forked from gregrickaby/wdsjQuery.js
WDS Javascript Style
/**
* Foo Script.
*/
window.Foo_Object = {};
( function( window, $, plugin ) {
// Private variable.
var fooVariable = 'foo';
// Constructor.
@jazzsequence
jazzsequence / bp-custom.php
Last active April 20, 2016 18:49
change default bp home to forum if forum exists
<?php
function wds_clp_set_bp_default_groups_extension( $default ) {
global $bp;
if ( bp_is_group() && $bp->groups->current_group->enable_forum ) {
return 'forum';
}
return $default;
}
add_filter( 'bp_groups_default_extension', 'wds_clp_set_bp_default_groups_extension' );
@jazzsequence
jazzsequence / update-forum-groupmeta.php
Last active April 19, 2016 19:20
Updates the group meta for forum id based on updated forum ids.
<?php
/*
Plugin Name: WDS CLP Update Forum Group Meta Script
Description: Updates the group meta for forum id based on updated forum ids.
Author: WebDevStudios
Author URI: http://webdevstudios.com
Version: 1.0
License: GPL2
*/
@jazzsequence
jazzsequence / cmb2_add_field.sublime-snippet
Last active July 11, 2016 21:21
Sublime Text snippets
<snippet>
<content><![CDATA[
->add_field( array(
'name' => __( '${1:Field Name}', '${2:textdomain}' ),
'id' => \$prefix . '${3:field_id}',
'type' => '${4:cmb2_field_type}',
'desc' => __( '${5:Description of the field.}', '${2:textdomain}' ),
${6:'options' =>} ${7:${8:array of options or callback function},}
${9:'attributes' =>} ${10:${11:array of attributes},}
${12:'default' =>} ${13:'${14:default_value}',}
@jazzsequence
jazzsequence / update.sql
Created February 12, 2016 21:24
Update wp_postmeta and wp_posts database tables with posts from another site
# What if you are trying to migrate a bunch of posts from one site into
# another site that already has content? We'll assume you already have
# a database export of the posts and postmeta you want to migrate. You
# will want to create a database locally to alter the tables to get them
# ready to merge into the production database that already has content.
# You will also need to know the highest `meta_id` and `ID` values from
# the `wp_postmeta` and `wp_posts` tables, respectively.
# First, we need to create new columns in the tables we have locally. To
# do this the right way, we are going to figure out what type of data
@jazzsequence
jazzsequence / plugin-ideas.md
Last active December 12, 2017 18:56
Plugin Ideas

Plugin Ideas

Just some pie-in-the-sky ideas for plugins so I don't forget.

  • Minutes to Read Provides a Medium-like estimate about how long an article/post would take to read. Figure out how Medium does this (has to be related to word count, which we can get from WordPress) and build something that works similarly.
    This is how Medium does it.

  • Local Localization User-specific localization options. Instead of site-wide, global language settings, localization settings could/should be specific to the user -- for instance, a developer building a site for a non-English-speaking company or having many users, some of whom speak one language and others that speak a different language. Would load a different language file per user.

  • WP Raffles Rafflecopter clone using WordPress that's done better.