Skip to content

Instantly share code, notes, and snippets.

View sc0ttkclark's full-sized avatar
🍕
Working hard reviewing and deploying code

Scott Kingsley Clark sc0ttkclark

🍕
Working hard reviewing and deploying code
View GitHub Profile
<?php
//**Most Commented On Posts Loop same as before**/
$args = array(
'date_query' => array(
//set date ranges with strings!
'after' => '1 week ago',
'before' => 'today',
//allow exact matches to be returned
'inclusive' => true,
),
<?php
//**Most Commented On Posts Loop same as before**/
$args = array(
'date_query' => array(
//set date ranges with strings!
'after' => '1 week ago',
'before' => 'today',
//allow exact matches to be returned
'inclusive' => true,
),
@sc0ttkclark
sc0ttkclark / gist:8661802
Created January 28, 2014 03:23
Give all admins access to pods_is_admin
<?php
function access_for_all_admins( $access ) {
if ( !$access && current_user_can( 'manage_options' ) ) {
$access = true;
}
return $access;
}
@sc0ttkclark
sc0ttkclark / pods-alternative-cache.php
Last active January 4, 2016 21:39
Pods Alternative Cache
<?php
/*
Plugin Name: Pods Alternative Cache
Plugin URI: http://pods.io/
Description: Alternative caching engine for Pods for large sites on hosts with hard limits on how much you can cache
Version: 1.0
Author: The Pods Framework Team
Author URI: http://pods.io/
*/
@sc0ttkclark
sc0ttkclark / gist:8768847
Created February 2, 2014 13:59
pods_api_post_save_pod_item_{pod} hook example
<?php
/**
* Filter the Pods saving process and run actions / modify values
*
* @param array $pieces An array of different variables you can *change*, see below
*
* List of $pieces variables includes:
*
* array $pieces['fields'] An array of fields on the Pod, 'value' key stores the *new* value if it's been set to save
*
@sc0ttkclark
sc0ttkclark / ahhhhh.php
Last active August 29, 2015 13:56 — forked from Shelob9/ahhhhh.php
<?php
function slug_tax_update_PRE( $pieces, $is_new_item, $id ) {
if ( 0 < $id ) {
$term = (int) $pieces[ 'fields' ][ 'tax' ][ 'value' ];
wp_set_object_terms( $id, $term, 'ant', false );
}
return $pieces;
@sc0ttkclark
sc0ttkclark / bbp-optimize.php
Last active June 28, 2019 16:41
bbPress Optimize -- Optimizes bbPress queries for large bbPress forums
<?php
/*
Plugin Name: bbPress Optimize
Plugin URI: https://www.scottkclark.com/
Description: Optimizes bbPress queries for large bbPress forums
Version: 1.1
Author: Scott Kingsley Clark
Author URI: https://www.scottkclark.com/
*/
@sc0ttkclark
sc0ttkclark / gistify497541.buddypress-separate-bbpress-forums-site.php
Last active September 12, 2015 16:40
Code to enable having the main bbPress forums on a separate sub-site. Requires: WP Multisite, BuddyPress on main site and network-activated, bbPress on main site and sub-site
<?php
/**
* Remove and add a custom function for bbPress' BuddyPress activity filter
*/
function custom_bbp_notifications_fix() {
if ( !defined( 'BBPRESS_FORUMS_BLOG_ID' ) || !BBPRESS_FORUMS_BLOG_ID ) {
return;
}
@sc0ttkclark
sc0ttkclark / 0-README.md
Last active December 1, 2023 10:12
PhpStorm.app (Standalone) Mac integration with Tower.app for diff and merge - https://youtrack.jetbrains.com/issue/WI-26090

PhpStorm.app (Standalone) Mac integration with Tower.app for diff and merge

How to use this

  1. Add CompareTools.plist and phpstorm.sh files in the ~/Library/Application Support/com.fournova.Tower3/CompareTools/ directory. You may need to mkdir ~/Library/Application\ Support/com.fournova.Tower3/CompareTools if the folder does not already exist
  2. Run chmod +x ~/Library/Application\ Support/com.fournova.Tower3/CompareTools/phpstorm.sh
  3. Go into Tower.app Preference > Git Config > Select "PhpStorm" for "Diff tool" and "Compare tool", you can optionally enable "Perform directory diff"

Other variations

@sc0ttkclark
sc0ttkclark / delete-orphan-gf-entry-data.sql
Created February 16, 2015 06:04
Delete all GF lead data if lead has been deleted
DELETE
lead_detail
FROM
wp_rg_lead_detail AS lead_detail
LEFT JOIN
wp_rg_lead AS lead ON lead.id = lead_detail.lead_id
WHERE
lead.id IS NULL;
DELETE