Skip to content

Instantly share code, notes, and snippets.

@atwellpub
atwellpub / functions.php
Created March 28, 2014 00:32
Solves Inboost theme conflict with WordPress Landing Pages
/* Landing Pages Theme Conflic Resolution */
if ( isset($_GET['post']) ) {
remove_action( 'widgets_init', 'inboost_widgets_init' );
}
@atwellpub
atwellpub / misc.php
Created March 26, 2014 03:50
Breeze theme fix for landing pages
<?php
function unisphere_portfolio_preset_content( $content ) {
global $post, $unisphere_options;
if ( $post->post_content == '' && $post->post_type == 'portfolio' ) {
$default_content = $unisphere_options['portfolio_default_text'];
} else {
$default_content = $content;
<?php
/* replace core tokens if available */
$template = str_replace( '{{cta-id}}' , $selected_cta['id'] , $template );
$template = str_replace( '{{variation-id}}' , $vid , $template );
$template = str_replace( '{{template-urlpath}}' , $selected_cta['templates'][$vid]['urlpath'] , $template );
$template = str_replace( '{{wordpress-ajaxurl}}' , admin_url( 'admin-ajax.php' ) , $template );
$template = str_replace( '{{cta-width}}' , $width , $template );
$template = str_replace( '{{cta-height}}' , $height , $template );
@atwellpub
atwellpub / example-hook.php
Created February 3, 2014 04:47
Secure WordPress JSON API with API Key
<?php
/* place in theme's functions.php file */
/* disable json api if api key not correct */
add_action('init','json_api_apikey_check' , 1 );
function json_api_apikey_check()
{
$api_key = 'hello';
$base = get_option('json_api_base', 'api');
$this_url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
@atwellpub
atwellpub / add-extension-settings-to-global-settings-code-example.php
Last active August 29, 2015 13:55
InboundNow - Add Settings to Global Settings Section
<?php
add_filter('lp_define_global_settings','inboundnow_mailchimp_add_global_settings');
add_filter('wpleads_define_global_settings','inboundnow_mailchimp_add_global_settings');
add_filter('wp_cta_define_global_settings','inboundnow_mailchimp_add_global_settings');
function inboundnow_mailchimp_add_global_settings($global_settings)
{
switch (current_filter())
{
@atwellpub
atwellpub / software-licensing-and-updating-code-example.php
Last active August 29, 2015 13:55
InboundNow - Prepare Extensions for Licensing and Updating
<?php
function inboundnow_mailchimp_extension_setup()
{
/*PREPARE THIS EXTENSION FOR LICENSING */
if ( class_exists( 'INBOUNDNOW_EXTEND' ) )
{
$license = new INBOUNDNOW_EXTEND( INBOUNDNOW_MAILCHIMP_FILE , INBOUNDNOW_MAILCHIMP_LABEL , INBOUNDNOW_MAILCHIMP_SLUG , INBOUNDNOW_MAILCHIMP_CURRENT_VERSION , INBOUNDNOW_MAILCHIMP_REMOTE_ITEM_NAME ) ;
}