Skip to content

Instantly share code, notes, and snippets.

View modemlooper's full-sized avatar
🏠
Working from home

modemlooper modemlooper

🏠
Working from home
View GitHub Profile
<?php
add_filter( 'json_query_vars', function( $valid_vars ) {
$valid_vars = array_merge( $valid_vars, array( 'meta_key', 'meta_value' ) );
return $valid_vars;
});
@imath
imath / bp-custom.php
Created August 14, 2014 13:18
This a snippet to auto join "just activated" members in one or more BuddyPress groups.
<?php
if ( ! class_exists( 'Imath_Auto_Join_Groups' ) ) :
/**
* AutoJoin new members to chosen groups
*
* This is a little snippet, feel free to :
* - use it
* - extend it..
@boonebgorges
boonebgorges / gist:8301715
Last active January 2, 2016 12:09
A filter to force BuddyPress's group search to work on a word-wise basis, instead of on exact matches using multiple words. In other words: out of the box, searching for "American History" will not return a group called "American Military History"; after this change, it will.
<?php
/**
* Modify BuddyPress group search to work on a word-wise basis
*/
function openlab_group_search_breakup( $sql, $s ) {
global $bp;
if ( ! empty( $s['search'] ) ) {
// Get the search terms
@imath
imath / tmp-functions.php
Last active December 14, 2015 10:59
This is a quick and dirty attempt in order to use the custom page template (an Admin can define in the WP Editor template select box) with BuddyPress 1.7 Theme Compat. I think the main challenge is not in loading the custom template, but it's too understand how the theme is rendering the layout. For instance : twentyeleven and twentytwelve are u…
<?php
/*
beginning of the code to paste in the functions.php of the active theme (twentyten, twentyeleven or twentytwelve)
If you want to adapt it to your theme, you'll need to check if it uses some body_class to render its layout and eventually
adapt lines 70 to 101.
*/
class Imath_WP_Editor_Template
{
@boonebgorges
boonebgorges / gist:4754549
Created February 11, 2013 13:57
Dynamically add items to a wp_nav_menu list
<?php
function bbg_activity_subnav( $items, $menu, $args ) {
// Find the Activity item
$bp_pages = bp_core_get_directory_page_ids();
if ( isset( $bp_pages['activity'] ) ) {
$activity_directory_page = $bp_pages['activity'];
} else {
return $items;
@AmyStephen
AmyStephen / Files.php
Last active July 5, 2017 17:47
General purpose folder and file processing for copy, move, delete, and size calculation
<?php
/**
* File class
*
* @package Molajo
* @copyright 2013 Amy Stephen. All rights reserved.
* @license MIT, GPL v2 or later
*/
namespace Molajo;
@bitfade
bitfade / filter.js
Last active October 5, 2018 18:09
WordPress 3.5 media upload, toolbar with custom filter
/*jslint undef: false, browser: true, devel: false, eqeqeq: false, bitwise: false, white: false, plusplus: false, regexp: false, nomen: false */
/*global wp,jQuery */
jQuery(document).ready(function($) {
if (!window.wp || !window.wp.media) {
return;
}
var media = window.wp.media;
<?php
/*
Plugin Name: Easy Digital Downloads - Variable Pricing License Activation Limits
Plugin URL: http://easydigitaldownloads.com/extension/
Description: Limit the number of license activations permitted based on variable prices
Version: 1.0
Author: Pippin Williamson
Author URI: http://pippinsplugins.com
Contributors: mordauk
*/
@r-a-y
r-a-y / gist:4145322
Created November 25, 2012 21:03
BuddyPress - Remove group activity post form
/**
* Remove the group activity post form
*/
add_action( 'bp_before_group_activity_post_form', create_function( '', 'ob_start();' ), 9999 );
add_action( 'bp_after_group_activity_post_form', create_function( '', 'ob_end_clean();' ), 0 );
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active November 25, 2024 14:56
Using Git with Subversion Mirroring for WordPress Plugin Development