Skip to content

Instantly share code, notes, and snippets.

@atwellpub
atwellpub / functions.php
Last active August 29, 2015 14:06
Possible woocommerce + landing pages compatibility fix. Add this to your theme's functions.php file
<?php
/* Remove all tracking classes from cart page */
add_action('wp_footer' , 'inbound_remove_cart_tracking_class' );
/**
* Removes tracking classes from forms containing the name 'proceeed'
*/
function inbound_remove_cart_tracking_class() {
?>
@atwellpub
atwellpub / autofollow.php
Created August 21, 2014 20:01
Automatically follow a twitter user on post save
<?php
$Twitter_Auto_Follow = new Twitter_Auto_Follow();
class Twitter_Auto_Follow {
static $TwitterAPIExchange;
public function __construct() {
@atwellpub
atwellpub / functions.php
Created August 14, 2014 20:13
Example of how to hook into inboundnow_form_submit_actions
<?php
/**
* inboundnow_form_submit_actions after form validationa and before user redirection.
*/
add_action('inboundnow_form_submit_actions','extension_send_data' , 10 , 2 );
/**
* This method will perform additional actions during the inboundnow_form_submit_actions hook
@atwellpub
atwellpub / functions.php
Created August 14, 2014 20:02
Example of how to hook into inbound_store_lead_post action hook
<?php
/**
* inbound_store_lead_post runs as an ajax call during a tracked form submission
*
* Use $lead data in crafting 3rd party connection
*/
add_action('inbound_store_lead_post','extension_send_data');
@atwellpub
atwellpub / functions.php
Created August 6, 2014 21:01
Fix for 301 redirect - Removes redirect_canonical for homepage only
<?php
/**
* Fix for 301 redirect - Removes redirect_canonical for homepage only
* @author Hudson Atwell (Inbound Now)
*
*/
function inbound_redirect_canonical($redirect_url, $requested_url) {
if ( is_front_page()) {
return $requested_url;
@atwellpub
atwellpub / functions.php
Created August 5, 2014 17:29
Example on how to add custom fields to constant contact using Inbound Now's Constant Contact extension and hooks.
<?php
/**
* This code snippit will attempt to add 2 custom fields to the ConstantContact contact data array before being sent to the API
* @author Hudson Atwell
*/
add_filter( 'inboundnow_constantcontact_lead_data' , 'add_custom_field' , 10 , 1 );
function add_custom_field( $contact ) {
/* You may have to look at all the key/value pairs in the $_POST variable to discover the correct key name */
@atwellpub
atwellpub / function.php
Created July 26, 2014 06:49
Example of how to relay lead data to an service api during a form submission.
<?php
add_action('inbound_store_lead_post' , 'relay_data_to_custom_service' );
function relay_data_to_custom_service( $lead_data ) {
if ($lead_data['page_id'] != '75' ) {
return;
}
@atwellpub
atwellpub / class.metaboxes.php
Created July 23, 2014 23:07
How to add settings to the 'Advanced Settings' metabox within calls to action.
<?php
/**
*This class hooks call to action settings into the 'Advanced Settings' metabox available when editing a call to action
*/
if ( !class_exists('CTA_Extension_Metaboxes') ) {
class CTA_Extension_Metaboxes
{
@atwellpub
atwellpub / extension-licensing.php
Created July 23, 2014 21:38
How to add license handling and extension updating to your Inbound Now extensio
<?php
/** Define constants somewhere in plugin */
define('EXTENSION_CURRENT_VERSION', '1.0.5' );
define('EXTENSION_LABEL' , 'Extension Integration' );
define('EXTENSION_SLUG' , plugin_basename( dirname(__FILE__) ) );
define('EXTENSION_FILE' , __FILE__ );
define('EXTENSION_REMOTE_ITEM_NAME' , 'extension-integration' );
define('EXTENSION_URLPATH', plugins_url( ' ', __FILE__ ) );
define('EXTENSION_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
@atwellpub
atwellpub / functions.php
Created July 19, 2014 20:04
Call to Action link tracking support for LeadBoxes Plugin
<?php
/**
* Call to Action Support for LeadBoxes
* adds click tracking listeners to call to action links containing the 'leadbox-track-me' class id.
*/
add_action('wp_footer' , 'inbound_cta_leadboxes_tracking');
function inbound_cta_leadboxes_tracking() {
?>