Skip to content

Instantly share code, notes, and snippets.

😎
Makin' teh codz.

Thomas Belknap holisticnetworking

😎
Makin' teh codz.
Block or report user

Report or block holisticnetworking

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
@holisticnetworking
holisticnetworking / index.html
Created Mar 25, 2019
Slick Carousel Opens Synced Bootstrap Modal
View index.html
<div class="slider-nav">
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=1" alt=""></div>
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=2" alt=""></div>
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=3" alt=""></div>
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=4" alt=""></div>
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=5" alt=""></div>
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=6" alt=""></div>
<div data-toggle="modal" data-target="#myModal"><img src="http://placehold.it/390x245&text=7" alt=""></div>
</div>
View not-so-simple-conditional.php
<?php
if ( username identified in system ) {
// Do things for an identified user
} else {
echo "Looks like you aren't logged in!";
}
View simple-condition-binary.php
<?php
if( $person is in group Van and in group Musical ) {
echo "Well, hello, Eddie!";
} else {
// This block of code could address Vans who aren't Musical,
// Musical people who aren't Vans, and all Europeans.
//
// That's a very big, not very specific list!
echo "Hello, stranger!";
}
View simple-condition.php
<?php
// Assuming the equation: 2 + 2 = $x
if( $x == 4 ) {
echo "Hurray! You win a thing!";
} else {
error_log( "Boo, dude. You screwed that up." );
}
@holisticnetworking
holisticnetworking / acf-local-json-after.php
Last active Mar 8, 2019
A successful addition to my theme to allow parent/theme failover of local JSON
View acf-local-json-after.php
<?php
// Integrating Advanced Custom Fields:
remove_filter( 'acf/settings/save_json', 'settings_save_json' );
add_filter( 'acf/settings/save_json', function() {
return get_stylesheet_directory() . '/Library/Acf-Json';
} );
remove_filter( 'acf/settings/load_json', 'settings_load_json' );
add_filter( 'acf/settings/load_json', function( $paths ) {
array_push(
$paths,
@holisticnetworking
holisticnetworking / acf-local-json-before.php
Last active Mar 8, 2019
A first attempt at applying new directories with parent failovers to ACF local JSON
View acf-local-json-before.php
<?php
// Integrating Advanced Custom Fields:
add_filter( 'acf/settings/save_json', function() {
return get_stylesheet_directory() . '/Library/Acf-Json';
} );
add_filter( 'acf/settings/load_json', function( $paths ) {
unset( $paths[0] );
$paths[] = get_template_directory() . '/Library/Acf-Json';
$paths[] = get_stylesheet_directory() . '/Library/Acf-Json';
return $paths;
View npm-error.txt
SYR-TBELKNAP-MAC18:source tbelknap$ npm install
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
> node-sass@3.13.1 install /Applications/MAMP/htdocs/InFocusTheme/source/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/darwin-x64-57_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/darwin-x64-57_binding.node":
HTTP error 404 Not Found
@holisticnetworking
holisticnetworking / set_default.php
Last active Jun 28, 2018
When working with the WordPress Customizer, you may want to be sure a theme mod gets set on save. Unless a setting gets changed in the Customizer, it's values do not go into the final theme_mods data. This object snippet will do just that for you. The Gist includes both the function to use and the hook to attach it to for checking on save.
View set_default.php
/**
* On Customizer save, checks for and sets a few
* default settings.
* @param \WP_Customize_Manager $wpcustomizer
*/
public function set_defaults( \WP_Customize_Manager $wpcustomizer ) {
$mod = get_theme_mod( 'my_theme_mod_name' );
if( empty( $mod ) ) {
set_theme_mod( 'my_theme_mod_name', 'x' );
}
@holisticnetworking
holisticnetworking / gist:d73e97f08afafafee14a8f2c939781e6
Last active Jun 19, 2018
Improved code using transient to provide caching of API calls.
View gist:d73e97f08afafafee14a8f2c939781e6
<?php
/**
* This code retrieves course data from an external API and displays it in the user's
* My Account area. A merchant has noticed that there's a delay when loading the page.
*
* 1) What changes would you suggest to reduce or remove that delay?
* 2) Is there any other code changes that you would make?
*/
public function add_my_courses_section() {
$courses = null;
@holisticnetworking
holisticnetworking / scheduler.php
Created Jan 16, 2018
Adding submenu to page.
View scheduler.php
public function admin_menu() {
add_submenu_page(
'publish_status',
'Scheduled Jobs',
'Scheduled Jobs',
'manage_options',
'admin.php?page=scheduled_jobs',
[ &$this, 'display_schedule' ]
);
}
You can’t perform that action at this time.