Skip to content

Instantly share code, notes, and snippets.

View butlerblog's full-sized avatar

Chad Butler butlerblog

View GitHub Profile
@butlerblog
butlerblog / qnd-wp-mail.php
Last active August 29, 2015 14:18
A quick-and-dirty plugin to filter the email from address and name
<?php
/*
Plugin Name: QnD wp_mail filter
Plugin URI: http://butlerblog.com/
Description: A quick and dirty plugin to change the wp_mail "from" address to be something other than wordpress@mydomain.com.
Version: 1.2
Author: Chad Butler
Author URI: http://butlerblog.com/
License: GPLv2
*/
<?php
/**
* Customize Event Query using Post Meta
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
*/
@butlerblog
butlerblog / wp-members-disable-new-user-notify.php
Last active September 8, 2015 17:33
Plugin to disable the sending of the new user registration email when the user is created in the Users > All Users screen. This file can be saved to the /wp-content/plugins/ then activated from the plugins menu.
<?php
/*
Plugin Name: WP-Members Disable New User Notification
Plugin URI: http://rocketgeek.com
Description: Disables the WP new user notification email when user is created via the Users > Add New screen.
Version: 1.0
Author: Chad Butler
Author URI: http://butlerblog.com/
License: GPLv2
*/
<?php
add_action( 'admin_bar_menu', 'wpse15186_admin_bar_menu' );
function wpse15186_admin_bar_menu( &$wp_admin_bar )
{
$menu = wp_get_nav_menu_object( 'WPSE 15186 test menu' );
$menu_items = wp_get_nav_menu_items( $menu->term_id );
$wp_admin_bar->add_menu( array(
'id' => 'wpse15186-menu-0',
'title' => 'WPSE 15186 menu',
<?php
function keyword_density_js(){
?>
<script src="<?php bloginfo('template_url'); ?>/js/jquery.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.wordstats.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.wordstats.en.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/highlight.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
var count = 8;
@butlerblog
butlerblog / wp_login_redirect.php
Last active September 23, 2015 13:33
Create WP login link with redirect back to original page.
<?php
global $wp;
$current_url = home_url( add_query_arg( array(), $wp->request ) );
?>
<a href="<?php echo wp_login_url( $current_url ); ?>">Log In</a>
@butlerblog
butlerblog / file-uploader.php
Last active March 12, 2016 16:48
Basic file upload handler for WP-Members
<?php
// Add to your functions.php file below this line.
/**
* Basic file uploader script for WP-Members.
*
* This code snippet handles file uploads when the "file" field type is
* selected for a registration field. Note that this snippet is basic and
* is not intended to be a full featured solution. Please do not ask me
* for support unless you are already a premium support subscriber at
@butlerblog
butlerblog / wpmem_user_upload_dir.php
Last active June 3, 2016 21:22
List of default values for the wpmem_user_upload_dir filter
<?php // Ignore this line.
add_filter( 'wpmem_user_upload_dir', 'my_user_upload_dir' );
function my_user_upload_dir( $args ) {
// Change default directory if user ID is "10"
if ( 10 == $args['user_id'] ) {
$args['wpmem_dir'] = 'special_dir/',
$args['user_dir'] = 'special_sub'
@butlerblog
butlerblog / wpmem_exp_ipn_defaults.php
Last active June 9, 2016 17:18
Sets WP-Members PayPal Module log file to verbose output.
<?php
<?php
/**
* This gist is set up to diplay the correct way to customize forms in WP-Members.
*
* It is in reference to this script file:
* https://github.com/danahutchins/wp-members-bootstrap-forms/blob/master/wp-members-pluggable.php
*
* The author of that script indicates in this post:
* http://www.inforest.com/updating-wp-members-wordpress-plugin-for-twitter-bootstrap/
* that "Rather than going to the trouble of writing hooks, I decided to simply