Skip to content

Instantly share code, notes, and snippets.

Kellen Mace kellenmace

Block or report user

Report or block kellenmace

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kellenmace
kellenmace / get-all-super-admins.php
Created Jan 7, 2019
Get all Super Admin users in WordPress
View get-all-super-admins.php
<?php
/**
* Get all Super Admin users on the current site.
*
* @return array WP_User objects.
*/
function get_all_superadmin_users() {
return get_users([
'login__in' => get_super_admins()
@kellenmace
kellenmace / get-all-non-super-admins.php
Created Jan 7, 2019
Get all non-Super Admin users in WordPress
View get-all-non-super-admins.php
<?php
/**
* Get all non-Super Admin users on the current site.
*
* @return array WP_User objects.
*/
function get_all_non_superadmin_users() {
return get_users([
'login__not_in' => get_super_admins()
View language-translation.txt
{
1 => [
'en-us' => [
'name' => 'Puff Pastry',
'description' => 'Sign up for Puff Pastry news...'
],
'fr-ca' => [
'name' => {French translation},
'description' => {French transalation}
]
@kellenmace
kellenmace / forecast-expand-row-tampermonkey-script.js
Created Oct 4, 2018
Forecast Expand Row Tampermonkey Script
View forecast-expand-row-tampermonkey-script.js
// ==UserScript==
// @name Expand Forecast Row
// @version 1.0
// @description Expand Forecast Row
// @author Kellen Mace
// @match https://forecastapp.com/485680/schedule/team*
// @grant none
// ==/UserScript==
(function(document) {
@kellenmace
kellenmace / php-sandbox-tampermonkey-script.js
Created Oct 4, 2018
sandbox.onlinephpfunctions.com Tampermonkey Script
View php-sandbox-tampermonkey-script.js
// ==UserScript==
// @name PHP Sandbox
// @version 0.1
// @description Customize PHP Sandbox styles
// @author Kellen Mace
// @match http://sandbox.onlinephpfunctions.com/
// @grant none
// ==/UserScript==
(function() {
@kellenmace
kellenmace / get-template-part-path.php
Created Sep 28, 2018
WordPress - get template part path
View get-template-part-path.php
<?php
/**
* Get template part path. This function is identical to WP's
* get_template_part(), except that it doesn't load the template -
* just returns it so that it can be required elsewhere and have
* access to variables in the local scope.
*
* Example usage:
* $template_data = 'make this variable available in template part';
View get-list-of-beaver-builder-modules-example.php
<?php
function test_get_beaver_builder_module_list() {
$bb_module_list = new KM_Beaver_Builder_Module_List();
// Get a list of the BB modules on the current page.
$current_page_modules_list = $bb_module_list->get();
// Get a list of the BB modules on the page with a post ID of '123'.
$page_123_modules_list = $bb_module_list->get( 123 );
@kellenmace
kellenmace / get-beaver-builder-modules-on-page.php
Last active Sep 26, 2018
Get a list of all the Beaver Builder modules on a page
View get-beaver-builder-modules-on-page.php
<?php
/**
* Class for getting a list of Beaver Builder modules.
*/
class KM_Beaver_Builder_Module_List {
/**
* Get the list of Beaver Builder modules.
*
* @param int $post_id The post ID. Default is the current post being
View data-immutability-1.php
<?php
$projects = wds_get_projects();
// ...do some work...
$active_projects = array_filter( $projects, function( $project ) {
return 'active' === $project['status'];
});
View rebuild-tx-data-import.php
<?php
// Pull $username, $password, $client_id, $client_secret from the options table
$connection = new \RebuildTexasMigrations\Core\Connection( $username, $password, $client_id, $client_secret );
$connection->connect();
if ( ! $connection->is_connected() ) {
wp_send_json_error( esc_html__( 'An error occurred while connecting to the Salesforce API. Please check your username and password and try again.', 'rebuild-migration' ) );
}
You can’t perform that action at this time.