Skip to content

Instantly share code, notes, and snippets.


Alec Kinnear foliovision

View GitHub Profile
foliovision / wp_is_mobile-wp-rocket.php
Created Feb 20, 2020
Make wp_is_mobile() use WP Rocket mobile detection
View wp_is_mobile-wp-rocket.php
Core WordPress function wp_is_mobile() detects iPad as mobile, so we filter it and use WP Rocket mobile detection
add_filter( 'wp_is_mobile', 'fv_bra_wp_is_mobile' );
function fv_bra_wp_is_mobile( $is_mobile ) {
if ( class_exists( 'Rocket_Mobile_Detect' ) ) {
$detect = new Rocket_Mobile_Detect();
foliovision / FV Player unload on magnificPopup closing.js
Created Feb 2, 2018
FV Player unload on magnificPopup closing
View FV Player unload on magnificPopup closing.js
jQuery(document).on('mfpClose', function() {
} );
foliovision /
Last active Sep 14, 2017
How to Set Up a Mac Securely for OS X Sierra

Securing the Computer

  1. don't plug in to internet
  2. chose a country (United Kingdom)
  3. refuse to share any info with apple or log in to iCloud (to make sure you don't get sucked in early)
  4. refuse location services
  5. restart
  6. still a German computer
    1. add a new language in Regions preferences
    2. some dialogues (restarting) still come in German after deleting German
View FV Player tweak - force load of CSS in header.php
add_action( 'wp_enqueue_scripts', 'tweak_fv_player_css_enqueue' );
function tweak_fv_player_css_enqueue() {
global $fv_fp;
if( method_exists( $fv_fp, 'css_enqueue' ) {
foliovision / bbpress-conversion-clean-up.php
Created May 24, 2016
bbPress 1 to bbPress 2 cleanup tool
View bbpress-conversion-clean-up.php
Please read the bbPress 1 conversion article on before using
global $wpdb;
$aPosts = $wpdb->get_results( "SELECT * FROM $wpdb->posts AS p JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type IN ('forum','topic','reply') AND ( meta_key = '_bbp_old_topic_id' ) LIMIT 10000 " );
View bbpress-fix-post-position.php
global $bbdb;
$aTopics = $bbdb->get_col( "SELECT topic_id FROM $bbdb->topics" );
foreach( $aTopics AS $iTopic ) {
echo $iTopic.'<br />';
foliovision / bbpress-subscribers-convert.php
Created May 24, 2016
Convert bbPress 1 favorite topics into topic subscriptions in bbPress 2
View bbpress-subscribers-convert.php
global $wpdb;
$aUsers = $wpdb->get_results("SELECT user_id,meta_value FROM $wpdb->usermeta WHERE meta_key = 'bb_favorites'");
$i = 0;
foreach($aUsers as $user){
foliovision / FV Player custom Ajax tracking.js
Last active Mar 16, 2018
Sample code for FV Player which detects if the user really watched the video to the end (seeking to the end won't suffice) and then sends the post ID using Ajax.
View FV Player custom Ajax tracking.js
flowplayer( function(api,root) {
var root = jQuery(root);
api.bind('progress', function(e,api,current) {
}).bind('finish ready ', function(e,api) {
for( var j in fv_ga_events ) {
foliovision / fv-pb-global-avatar.php
Last active Oct 24, 2016
Profile Builder - make the custom avatars global for WP Multisite
View fv-pb-global-avatar.php
if( is_multisite() && function_exists('switch_to_blog') ) {
add_filter( 'get_avatar', 'fv_pb_global_avatar_start', 20, 5 );
add_filter( 'get_avatar', 'fv_pb_global_avatar_end', 22, 5 );
function fv_pb_global_avatar_start( $avatar ) {
return $avatar;
foliovision / wp-mu-in-subdirectory.php
Created Jan 19, 2015
WP Multisite fix for WP install in a directory
View wp-mu-in-subdirectory.php
Our Wordpress is located in
Here's the relevant part of our wp-config.php
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', '');