Skip to content

Instantly share code, notes, and snippets.

@bryanwillis
bryanwillis / custom_progress_bar.php
Created October 23, 2019 21:54 — forked from jwahlin/custom_progress_bar.php
Combine Formidable stats with SKT Skillset shortcode
add_shortcode( 'custom_progress_bar', 'add_custom_progress_bar' );
function add_custom_progress_bar( $atts ) {
if (
! isset( $atts['user'] ) || ! isset( $atts['goal'] ) || ! isset( $atts['year_month'] )
|| ! isset( $atts['title'] ) || ! isset( $atts['goal_id'] )
) {
return '';
}
// Get total amount completed for the current month
@bryanwillis
bryanwillis / gist:a951084c107ce139d17c079661206fe0
Created April 20, 2016 19:25 — forked from maoueh/gist:8260199
OpenELEC (4.0.1) WIFI connection details using `connman`

Even though there is a nice XBMC add-on to configure your WIFI settings, sometimes, you may still want to setup the WIFI connection for many reasons or just for fur.

OpenELEC use connman for managing connection to the various available network.

Setuping connman to connect to your protected WIFI network is an easy requiring you only to create a config file and enter some commands in a shell.

@bryanwillis
bryanwillis / list-comment-filters.php
Created January 14, 2016 07:31 — forked from thefuxia/list-comment-filters.php
WordPress Plugin: List Comment Filters
<?php
/*
Plugin Name: List Comment Filters
Description: List all comment filters on wp_footer
Version: 1.1
Author: Thomas Scholz
Author URI: http://toscho.de
License: GPL v2
*/
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@bryanwillis
bryanwillis / defer-async-scripts.php
Created January 11, 2016 07:13 — forked from wpscholar/defer-async-scripts.php
Class that allows you to async and defer scripts in WordPress by adding data.
<?php
class WP_Scholar_Defer_Scripts {
public static function initialize() {
add_filter( 'script_loader_tag', array( __CLASS__, 'defer_scripts' ), 10, 2 );
add_filter( 'script_loader_tag', array( __CLASS__, 'async_scripts' ), 10, 2 );
}
public static function defer_scripts( $tag, $handle ) {
@bryanwillis
bryanwillis / actions_and_filters.log
Created January 11, 2016 07:10 — forked from birgire/actions_and_filters.log
WordPress: Here we list all (exl. gettext) actions & filters that run when the `edit.php` (post) screen is loaded without any plugins and with a default theme activated:
Here we list all do_action, do_action_ref_array, apply_filters and apply_filters_ref_array calls (excluding gettext) for the edit.php (post) screen.php:
---
muplugins_loaded - do_action
pre_site_option_siteurl - apply_filters
default_site_option_siteurl - apply_filters
pre_option_siteurl - apply_filters
option_siteurl - apply_filters
site_option_siteurl - apply_filters
<?php
/* Template Name: Tribe Events Mike's Template */
global $wp_query;
$id = $wp_query->get_queried_object_id();
$sidebar = get_post_meta($id, "qode_show-sidebar", true);
$enable_page_comments = false;
if(get_post_meta($id, "qode_enable-page-comments", true)) {
$enable_page_comments = true;
@bryanwillis
bryanwillis / wordpress_move
Created January 11, 2016 01:36 — forked from rosemarystanley/wordpress_move
SQL query to move Wordpress to new URL
UPDATE `wp_options` SET `option_value` = REPLACE (`option_value`,'http://old/url', 'http://new/url') WHERE `option_value` LIKE '%http://old/url%';
UPDATE `wp_postmeta` SET `meta_value` = REPLACE (`meta_value`,'http://old/url', 'http://new/url') WHERE `meta_value` LIKE '%http://old/url%';
UPDATE `wp_posts` SET `post_content` = REPLACE (`post_content`,'http://old/url', 'http://new/url') WHERE `post_content` LIKE '%http://old/url%';
/* WP Gallery Plugin */
delimiter //
DROP PROCEDURE IF EXISTS update_wp_gallery_slides;
CREATE PROCEDURE update_wp_gallery_slides()
BEGIN
IF EXISTS (SELECT * FROM `wp_gallery_slides`) THEN
@bryanwillis
bryanwillis / jquery.qDefer.min.js
Last active January 9, 2016 23:26 — forked from RonnyO/jquery.qDefer.min.js
Simply mimic the 'defer' attribute for inline scripts across all browsers (jQuery helper)
// http://bit.ly/qDefer
$(function(){$('script[type="text/javascript/defer"]').each(function(){$(this).clone().attr('type','').insertAfter(this)})});
@bryanwillis
bryanwillis / licence activation.php
Last active October 18, 2021 23:52 — forked from mattradford/licence activation.php
ACF5 Pro ( Advanced Custom Fields ) licence activation. Could be adapted for any other plugin that requires a licence key, but doesn't yet support defining it in wp-config. Fires on theme activation.
// Place this in wp-config
define('ACF_5_KEY','yourkeyhere');
// Set ACF 5 license key on theme activation. Stick in your functions.php or equivalent.
function auto_set_license_keys() {
if ( !get_option('acf_pro_license') && defined('ACF_5_KEY') ) {
$save = array(
'key' => ACF_5_KEY,