Skip to content

Instantly share code, notes, and snippets.

Ben Klocek benklocek

  • Bracia.com
Block or report user

Report or block benklocek

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
@benklocek
benklocek / unhook_recurring_events_community.php
Created May 30, 2017 — forked from GeoffEW/unhook_recurring_events_community.php
Removes the recurring events option from Community Events
View unhook_recurring_events_community.php
<?php
/* Apply the following snippet in the functions.php file of your theme (without the PHP tag at the top) */
add_action( 'tribe_events_community_form', function() {
$event_form = Tribe__Events__Community__Main::instance()->form;
remove_action( 'tribe_events_date_display', array( $event_form, 'loadRecurrenceData' ) );
}, 5 );
View gist:fdca1a51d498abd5afb5f377530c607b
#Get the size of each table, ordered by largest to smallest
SELECT table_name AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "YOU+TABLE+NAME+HERE"
ORDER BY (data_length + index_length) DESC;
#Get the size of the entire DB
SELECT table_schema "DB Name",
Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
@benklocek
benklocek / beaver-builder-friendly.php
Created Mar 9, 2016 — forked from brentjett/beaver-builder-friendly.php
Making a Theme Beaver Builder Friendly
View beaver-builder-friendly.php
<?php
// I add a simple function to my functions.php that lets me do clean page-builder checks inside my template files.
// This is safe to include regardless of if bb-plugin is active or not. Won't trigger error.
function is_builder_layout() {
if (class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled()) return true;
return false;
}
// Inside page.php I use is_builder_layout() to determine layout
if (is_builder_layout()) {
View plugin-class-demo.php
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Plugin Class Demo
* Description: How I am using the base class in plugins.
* Plugin URI:
* Version: 2012.09.29
* Author: Thomas Scholz
* Author URI: http://toscho.de
* License: GPL
* Text Domain: plugin_unique_name
@benklocek
benklocek / nginx
Created Dec 3, 2015 — forked from psd/nginx
query string matching in nginx
View nginx
map $query_string $new_url {
~a=1 http://www.gov.uk/1;
~a=2 http://www.gov.uk/2;
~a=3&b=1|b=1&a=3 http://www.gov.uk/31;
~\ba=4\b.*\bb=2\b|\bb=2\b.*\ba=4\b http://www.gov.uk/42;
}
server {
server_name lrc.businesslink.gov.uk;
@benklocek
benklocek / gist:b0c88b2db224bed66b55
Last active Nov 25, 2015 — forked from ntwb/gist:3133449
bbPress custom bbp_list_forums
View gist:b0c88b2db224bed66b55
<?php
// Custom bbp_list_forums bbPress code by @Lynq
// Demo: http://teamoverpowered.com/forums/
// Code Discussion: http://bbpress.org/forums/topic/customising-bbp_list_forums-last-poster-block/
public function custom_bbp_list_forums( $args = '' ) {
// Define used variables
$output = $sub_forums = $topic_count = $reply_count = $counts = '';
$i = 0;
@benklocek
benklocek / bbpress-import-timer.js
Created Nov 24, 2015
Time between BBPress Import messages
View bbpress-import-timer.js
var el = document.getElementById("bbp-converter-message");
el.addEventListener("DOMSubtreeModified", function(){console.log("New Message at " + new Date())}, false);
View ntwb_bbpress_custom_views.php
<?php
/*
Plugin Name: bbPress - Custom Views
Plugin URI: https://gist.github.com/ntwb/8167699
Description: bbPress - bbPress - Custom Views
Version: 0.1
Author: Stephen Edgar - Netweb
Author URI: http://netweb.com.au
*/
@benklocek
benklocek / functions.php
Last active Mar 22, 2016 — forked from zaerl/functions.php
Custom bbPress role names
View functions.php
function my_custom_roles( $role, $user_id ) {
if( $role == 'Keymaster' )
return 'Site Owner';
return $role;
}
add_filter( 'bbp_get_user_display_role', 'my_custom_roles', 10, 2 );
@benklocek
benklocek / cpt-custom-messages.php
Last active Feb 21, 2019 — forked from thenbrent/gist:1625033
WordPress Custom Post Type Message
View cpt-custom-messages.php
/**
* Replaces "Post" in the update messages for custom post types on the "Edit" post screen.
*
* For example, for a "Product" custom post type, "Post updated. View Post." becomes "Product updated. View Product".
*
* @param array $messages The default WordPress messages.
*/
function pico_custom_update_messages( $messages ) {
global $post, $post_ID;
You can’t perform that action at this time.