Skip to content

Instantly share code, notes, and snippets.

View tylerdigital's full-sized avatar

Nathan Tyler tylerdigital

View GitHub Profile
add_filter( 'ssa_mailchimp_subscriber_data', 'ssa_set_custom_mailchimp_merge_fields', 10, 3 );
function ssa_set_custom_mailchimp_merge_fields( $subscriber_data, $customer_information, $appointment_type_id ) {
$subscriber_data['merge_fields']['SITUATION'] = $customer_information['Current Situation'];
return $subscriber_data;
}
#!/bin/bash
if [[ -z $3 ]]; then
echo "usage $0
type (plugin or theme)
message
directory"
exit;
fi
if [[ $1 != 'plugin' && $1 != 'theme' ]]; then
echo "Type is not plugin or theme! Goodbye!"
@tylerdigital
tylerdigital / helpscout-rest-controller.php
Created March 31, 2016 06:06 — forked from bradyvercher/helpscout-rest-controller.php
A starter WP REST API controller for creating a Dynamic App for Help Scout. http://developer.helpscout.net/custom-apps/dynamic/
<?php
/**
* Help Scout REST controller class.
*
* @license GPL-2.0+
* @link http://developer.helpscout.net/custom-apps/dynamic/
*/
class HelpScout_REST_Controller {
/**
* Secret key.
function td_debug_log($sMsg = NULL) {
if (!is_string($sMsg)) $sMsg = print_r($sMsg, true);
$sFile = dirname(__FILE__) . '/~log.txt';
$fh = fopen($sFile, 'a+');
if ($fh !== FALSE)
{
if ($sMsg === NULL)
fwrite($fh, date("\r\nY-m-d H:I:s:\r\n"));
else
fwrite($fh, date('Y-m-d H:i:s - ') . $sMsg . "\r\n");
@tylerdigital
tylerdigital / gist:e5616db2def62fc94af1
Created May 28, 2015 19:25
Update WordPress plugins and commit to git with WP-CLI
for plugin in `/usr/local/bin/wp plugin list --update=available --field=name`; do
/usr/local/bin/wp plugin update $plugin
git add .
git add -u .
git commit -m "Updating plugin $plugin"
done
@tylerdigital
tylerdigital / gist:717d432cf71bd87f7bd4
Last active August 12, 2018 13:24
Advanced Custom Logic workflow with Gravity Forms to Asana
<?php
add_filter( 'gfasana_task_details', 'my_custom_asana_logic', 10, 5 );
function my_custom_asana_logic( $asana_task, $user_index, $project_index, $entry, $form ) {
/* $asana_task array format: */
/*
Array
(
[workspace] => 1234567890123 // don't change this almost ever
[name] => New Task - overridden // string of text for task name
[notes] => long description here // string of texgt
@tylerdigital
tylerdigital / gist:7ae063f8c3630e88f61c
Created December 31, 2014 20:44
Hide children posts in admin index for hierarchical WordPress posts
add_action( 'pre_get_posts', array( $this, 'hide_children_posts' ) );
function hide_children_posts( $query ) {
if ( !is_post_type_archive( 'hotspot' ) || !is_admin() ) return;
$query->set( 'post_parent', 0 );
}
@tylerdigital
tylerdigital / gist:c127ae0c33f456b1f6c6
Created December 31, 2014 20:43
Fix WordPress Hierarchical Post Performance Issue
add_action( 'pre_get_posts', array( $this, 'fix_hierarchy_performance_issue' ) );
function fix_hierarchy_performance_issue( $query ) {
if ( $query->query['post_type']=='hotspot' && $query->query['orderby']=='menu_order title' ) {
$query->set( 'orderby', 'menu_order title post_name' );
}
}
<?php
add_filter( 'soliloquy_output_slide', 'tgm_soliloquy_custom_html', 10, 4 );
function tgm_soliloquy_custom_html( $html, $id, $image, $data ) {
// If the ID doesn't match the one we want to modify, return the default HTML output. Change 324 to your slider ID.
$slider_id = $data['id'];
if ( '1937' != $slider_id ) return $html;
ob_start(); ?>
<span class="social-m">
<?php $summary = get_field('short_description');?>