Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Olbekson c3mdigital

  • WebDev Studios
  • Houston, TX
View GitHub Profile
View stream-user-generator.php
<?php
/**
* Plugin Name: Stream User Generator
* Description: Generates X-Team users for testing
* Version: 0.1
* Author: johnregan3
* Author URI: http://johnregan3.me
*
* USE:
* Upload this into your Plugins directory.
@c3mdigital
c3mdigital / wp_dequeue_media.php
Last active Aug 29, 2015
Dequeue the media javascript libraries loaded with wp_enqueue_media
View wp_dequeue_media.php
/**
* Remove media library javascript files to prevent other plugins from conflicting with yours.
*/
function dequeue_media_conflicts() {
if ( 'your_plugin_hook_name' !== get_current_screen() ) {
return;
}
wp_dequeue_script( 'media-upload' );
wp_enqueue_script( 'media-editor' );
View Vagrantfile.diff
diff --git Vagrantfile Vagrantfile
index 65de7b1..40ba133 100644
--- Vagrantfile
+++ Vagrantfile
@@ -33,7 +33,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
v.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box"
end
- if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) == nil
- config.vm.synced_folder ".", "/srv", nfs: true
View nginx.conf
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
http {
@c3mdigital
c3mdigital / nginx.conf
Created May 22, 2012
Updated Ningx.conf and WordPress multi site block
View nginx.conf
## Start nginx.conf
user www-data;
worker_processes 8;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
@c3mdigital
c3mdigital / sidebar_select.php
Created Jun 3, 2012
Sidebar Select Meta Box for cmb_meta_boxes
View sidebar_select.php
<?php
/**
* Adds a new sidebar_select field type to CMB Metaboxes
*
* Builds the select box from all registered sidebars.
* Use in themes to create per page or post layout options without having to create new templates
*
* @see https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress.git
*
*/
@c3mdigital
c3mdigital / inspect_hooks.php
Created Jun 22, 2012 — forked from stephenh1988/inspect_hooks.php
Inspect hooks in WP by adding &debug=true&hook=my_hook_name to the request URl
View inspect_hooks.php
<?php
/**
* Plugin Name: Hook Debug Output
* Plugin URI: http://unserkaiser.com
* Description: Debug Hooked filter callback functions with adding <code>?debug=secret&hook=your_hook_name</code> to the URl
* Version: 0.1
* Author: Stephen Harris, Franz Josef Kaiser
* Author URI: http://unserkaiser.com
*/
// Prevent loading this file directly - Busted!
@c3mdigital
c3mdigital / get_perm_byname.php
Created Jul 26, 2012
Get WordPress permalink from post, page or custom post type name
View get_perm_byname.php
<?php
/**
* Gets the permalink from the post slug
* @param string $name the post, page or custom post type slug
* @param string $p_type the post type
*
* @return string The permalink YAHHH!!!
*/
function get_perm_byname( $name, $p_type = 'page' ) {
@c3mdigital
c3mdigital / front-end-uploads.php
Created Nov 16, 2012
Two file upload handler functions
View front-end-uploads.php
/**
* File upload ajax handler function to save the file and send image or file html back to the browser
* These functions are part of a class
*/
function ajax_upload_file() {
check_ajax_referer( 'ugc_user_upload', 'nonce' );
$file_data = array(
'name' => $_FILES['ugc_attachment_file']['name'],
'type' => $_FILES['ugc_attachment_file']['type'],
'tmp_name' => $_FILES['ugc_attachment_file']['tmp_name'],
@c3mdigital
c3mdigital / WordPress.xml
Created Nov 18, 2012
WordPress coding style for PhpStorm
View WordPress.xml
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="WordPress">
<option name="USE_SAME_INDENTS" value="true" />
<option name="IGNORE_SAME_INDENTS_FOR_LANGUAGES" value="true" />
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />