Skip to content

Instantly share code, notes, and snippets.

@atwellpub
atwellpub / wordpress-nav-meny-js-handler.php
Created May 28, 2014 23:52
WordPress Plugin - Print Nav Menu - API
<?php
/*
Plugin Name: Print Nav Menu API
Plugin URI: http://www.inboundnow.com/landing-pages/
Description: Listens for nav menu requests and returns html content
Version: 1.0.1
Author: Hudson Atwell
Author URI: http://www.hudsonatwell.co
*/
@atwellpub
atwellpub / example.php
Last active August 29, 2015 14:04
Adds settings to the 'default' landing page template via custom plugin code or an active theme's functions.php file
<?php
add_filter('lp_extension_data','lp_rebuild_old_data_configurations_to_suit_new_convention');
function lp_rebuild_old_data_configurations_to_suit_new_convention($lp_data)
{
$lp_data['default']['settings']['new_setting'] = array(
'label' => "New setting",
'description' => "Description of new setting here. Will be placed in tooltip"
'id' => 'new_setting',
@atwellpub
atwellpub / single-landing-page.php
Created July 15, 2014 23:56
Example of how to import the custom setting added to the default landing page template options.
/* Landing Page Meta Values */
$sidebar = lp_get_value($post, 'default', 'sidebar');
$display_nav = lp_get_value($post, 'default', 'display-nav');
$new_setting = lp_get_value($post, 'default', 'new_setting');
lp_conversion_area(); /* Print out form area content */
@atwellpub
atwellpub / single-landing-page.php
Created July 15, 2014 23:57
Example single-landing-pages.php file for integrating the landing-page custom post type with an active WordPress theme.
<?php get_header(); ?>
<?php $left_or_right = lp_get_value($post, 'default', 'sidebar'); ?>
<div id="main" class="container">
<?php if($left_or_right === "left") { ?>
<!-- SIDEBAR START -->
<section id="sidebar" class="grid one-third">
<?php lp_conversion_area(); /* Print out form content */ ?>
</section>
@atwellpub
atwellpub / functions.php
Created July 16, 2014 18:24
Temporary fix for Woocommerce 'proceed to checkout' bug while Inbound Now tools are installed.
<?php
/**
* Removes tracking class 'wpl-track-me' from woocommerce cart display form'
*/
add_action('wp_footer' , 'remove_cart_tracking_class');
function remove_cart_tracking_class() {
?>
<script type='text/javascript'>
jQuery( document ).ready(function() {
@atwellpub
atwellpub / functions.php
Created July 18, 2014 00:21
Add this code to your theme's functions.php code to enable geoplugin.com's geotargeting js script and auto-set the country dropdown to the correct country code
<?php
/**
* Adds geotargeting js capabilities to javascript
*/
add_action( 'wp_enqueue_scripts' , 'inbound_add_geotargeting_js' );
function inbound_add_geotargeting_js () {
wp_enqueue_script( 'geoplugin' , 'http://www.geoplugin.net/javascript.gp');
}
@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() {
?>
@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 / 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 / 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;
}