Skip to content

Instantly share code, notes, and snippets.

Thomas Griffin thomasgriffin

Block or report user

Report or block thomasgriffin

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
View gist:42f4b2acce8a5eb56a3c94c68f2c23dc
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '532160876956612',
autoLogAppEvents : true,
xfbml : true,
version : 'v3.2'
});
};
@thomasgriffin
thomasgriffin / deletecustomvariable.js
Created Dec 9, 2015
OptinMonster Dynamic Text Replacement API - deleteCustomVariable
View deletecustomvariable.js
<script type="text/javascript">
var OptinMonsterCustomVariables = function(app) {
/**
* API method for deleting a custom variable. Must be accessed via the app object.
*
* @param string $key The custom variable to delete.
* @return null
*/
app.deleteCustomVariable('foo');
};
@thomasgriffin
thomasgriffin / hascustomvariables.js
Created Dec 9, 2015
OptinMonster Dynamic Text Replacement API - hasCustomVariables
View hascustomvariables.js
<script type="text/javascript">
var OptinMonsterCustomVariables = function(app) {
/**
* API method for checking if any custom variable has been registered.
* Must be accessed via the app object.
*
* @return bool True if any custom variable has been registered, false otherwise.
*/
app.hasCustomVariables();
};
@thomasgriffin
thomasgriffin / hascustomvariable.js
Last active Dec 9, 2015
OptinMonster Dynamic Text Replacement API - hasCustomVariable
View hascustomvariable.js
<script type="text/javascript">
var OptinMonsterCustomVariables = function(app) {
/**
* API method for checking if a custom variable has been registered.
* Must be accessed via the app object.
*
* @param string $key The custom variable key to check.
* @return bool True if the custom variable exists, false otherwise.
*/
app.hasCustomVariable('foo');
@thomasgriffin
thomasgriffin / getcustomvariables.js
Created Dec 9, 2015
OptinMonster Dynamic Text Replacement API - getCustomVariables
View getcustomvariables.js
<script type="text/javascript">
var OptinMonsterCustomVariables = function(app) {
/**
* API method for retrieving all custom variables. Must be accessed via the app object.
*
* @return object A JavaScript object with key/value pairs for custom variables.
*/
app.getCustomVariables();
};
</script>
@thomasgriffin
thomasgriffin / getcustomvariable.js
Created Dec 9, 2015
OptinMonster Dynamic Text Replacement API - getCustomVariable
View getcustomvariable.js
<script type="text/javascript">
var OptinMonsterCustomVariables = function(app) {
/**
* API method for retrieving a custom variable. Must be accessed via the app object.
*
* @param string $key The custom variable key to retrieve.
* @return string|bool The value of the custom variable key or false if not found.
*/
app.getCustomVariable('foo');
};
@thomasgriffin
thomasgriffin / setcustomvariable.js
Last active Dec 9, 2015
OptinMonster Dynamic Text Replacement API - setCustomVariable
View setcustomvariable.js
<script type="text/javascript">
var OptinMonsterCustomVariables = function(app) {
/**
* API method for setting a custom variable. Must be accessed via the app object.
*
* @param string $key The custom variable key to set.
* @param string $value The custom variable value to set for the key.
* @return null
*/
app.setCustomVariable('foo', 'bar');
@thomasgriffin
thomasgriffin / variablefunctioncallback.js
Last active Aug 28, 2018
OptinMonster Dynamic Replacement API - variable function callback example.
View variablefunctioncallback.js
<script type="text/javascript">
var OptinMonsterCustomVariables = function(app) {
app.setCustomVariable('name', 'Thomas');
};
</script>
@thomasgriffin
thomasgriffin / customvariablefunction.js
Created Dec 9, 2015
OptinMonster Dynamic Replacement API - function callback example.
View customvariablefunction.js
<script type="text/javascript">
function OptinMonsterCustomVariables(app) {
app.setCustomVariable('name', 'Thomas');
}
</script>
@thomasgriffin
thomasgriffin / gist:c4e9e0d2f8254f6c4cf9
Created May 4, 2015
Exclude optin if on a certain category.
View gist:c4e9e0d2f8254f6c4cf9
<?php
add_filter( 'optin_monster_api_output', 'tgm_om_filter_lightbox_by_category', 10, 4 );
function tgm_om_filter_lightbox_by_category( $optins, $optin, $fields, $post_id ) {
// If in a particular category, remove the lightbox.
$cat_exc = 362; // Replace with the category ID to target.
$slug = 'sjdfhsjakdkg'; // Replace with the unique slug for the lightbox you want to remove.
$categories = wp_get_object_terms( $post_id, 'category', array( 'fields' => 'ids' ) );
foreach ( (array) $categories as $category_id ) {
if ( $category_id && $category_id == $cat_exc && in_array( $slug, $optins ) ) {
You can’t perform that action at this time.