Skip to content

Instantly share code, notes, and snippets.

@r-a-y
r-a-y / ray.php
Created March 31, 2015 16:51
Debug log function for WordPress. Put this in /wp-content/mu-plugins/.
<?php
function ray_log( $message ) {
if ( empty( $message ) )
return;
error_log( '[' . gmdate( 'd-M-Y H:i:s' ) . '] ' . $message . "\n", 3, WP_CONTENT_DIR . '/ray.log' );
}
@r-a-y
r-a-y / bp-disable-translation.php
Created February 15, 2015 18:40
Disable automatic translations by WordPress.org / GlotPress for BuddyPress.
<?php
/*
Plugin Name: BP Disable Auto Translation
Description: Disables automatic translations by WordPress.org / GlotPress for BuddyPress.
Author: r-a-y
License: GPLv2 or later
*/
/**
* Disables automatic translations for BuddyPress.
@r-a-y
r-a-y / wpadd
Last active January 21, 2020 00:19
Bash function to quickly install / update a WordPress plugin / theme and commit the addition in Git. Shove this in your .bashrc.
# Bash function to quickly install / update a plugin / theme and commit the addition.
#
# Function should be run from the root WP directory.
#
# Requires:
# wp-cli - http://wp-cli.org; should be used as 'wp'
# git - duh'doy! :)
#
# Usage:
# wpadd -slug "slug-of-item" -new "1.0.0"
@r-a-y
r-a-y / ray-bp-all-blog-posts.php
Created June 12, 2014 02:19
BuddyPress - Merge both blog posts and BP Groupblog posts together when using the "Recent Networkwide Posts" widget.
/**
* Merges both blog posts and groupblog posts together when using the "Recent
* Networkwide Posts" widget supplied by BuddyPress.
*/
function ray_merge_blog_posts_and_groupblog_posts( $retval ) {
// check the Recent Networkwide Posts activity args
// make sure they all match
if ( 'new_blog_post' === $retval['action'] &&
0 == $retval['user_id'] &&
false == $retval['scope'] &&
@r-a-y
r-a-y / hwdsb-hidesites.php
Created May 26, 2014 17:35
Removes the main site and the current blog from the adminbar for those that do not have publishing rights in WordPress.
<?php
/*
Plugin Name: HWDSB Remove Sites From Adminbar.
Description: Removes the main site and the current blog from the adminbar for those that do not have publishing rights.
Version: 0.1
Author: r-a-y
Author URI: http://profiles.wordpress.org/r-a-y
*/
class HWDSB_Remove_Sites_Adminbar {
@r-a-y
r-a-y / readme.md
Last active September 28, 2023 05:36
Using node.js / npm with PortableGit

Prologue

I develop on Windows (yeah, I hear your jeers, linux users!), so to use Git, I use Git for Windows.

However, I use Git for Windows (portable version) so I can keep my dev environment centrally located. This is so I can reuse this environment simply by copying my PortableGit directory to a USB drive.

Using a portable set up means you can't use those handy automatic installers to your dev environment. This makes installing other scripts like node.js a little bit more difficult because you have to manually do-it-yourself. No biggie! This is what this guide is for!

Installation

@r-a-y
r-a-y / bp-activity-comments-stream.php
Created April 16, 2014 22:02
Force activity loops in BuddyPress to show activity comments as separate entries all the time.
<?php
/*
Plugin Name: BuddyPress - Show Individual Activity Comments Separately
Description: Force activity loops to show activity comments as separate entries.
Version: 0.1
Author: r-a-y
Author URI: http://profiles.wordpress.org/r-a-y
License: GPLv2 or later
*/
@r-a-y
r-a-y / disable-email-on-sitewide-tags.php
Last active August 29, 2015 13:56
Disables email from sending on a WPMU Sitewide Tags blog.
<?php
/*
Plugin Name: WPMU Sitewide Tags - Disable Email
Description: Disables email from sending on a WPMU Sitewide Tags blog.
Author: r-a-y
Version: 0.1
*/
/**
* Disables emails from firing on the WPMU Sitewide Tags blog.
@r-a-y
r-a-y / ray-disable-mail.php
Created February 13, 2014 00:12
Disables all email from being sent on a WordPress install.
<?php
/*
Plugin Name: Disable Email
Description: Disables all email from being sent.
Author: r-a-y
Version: 0.1
*/
if( ! function_exists( 'wp_mail' ) ) :
function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
@r-a-y
r-a-y / bbp-site-public-hotfix.php
Created February 4, 2014 19:45
Fix bbPress' bbp_is_site_public() function.
<?php
/*
Plugin Name: bbPress - Fix Site Public function
Description: Hotfix for bbPress' bbp_is_site_public() function.
Version: 0.1
Author: r-a-y
Author URI: http://profiles.wordpress.org/r-a-y
*/
/**