Skip to content

Instantly share code, notes, and snippets.

View thomasgriffin's full-sized avatar
👋

Thomas Griffin thomasgriffin

👋
View GitHub Profile
@thomasgriffin
thomasgriffin / gist:4ee7f6bc037536ec15e6
Created October 24, 2014 19:52
Remove Soliloquy license notices and Settings page for handling license keys.
<?php
add_action( 'init', 'tgm_remove_soliloquy_license_stuff', 999 );
function tgm_remove_soliloquy_license_stuff() {
// Do nothing if Soliloquy is not active.
if ( ! class_exists( 'Soliloquy' ) ) {
return;
}
// Remove the Settings menu and license notices.
@thomasgriffin
thomasgriffin / gist:d5fd056b8b3dbae1ecbe
Last active August 29, 2015 14:07
Remove any posts from the featured content slider that do not have images in Soliloquy.
<?php
add_filter( 'soliloquy_fc_slider_data', 'tgm_sol_remove_no_image' );
function tgm_sol_remove_no_image( $data ) {
// Loop through the data and remove any items that don't have images.
foreach ( (array) $data['slider'] as $id => $item ) {
if ( empty( $item['src'] ) ) {
unset( $data['slider'][$id] );
}
}
@thomasgriffin
thomasgriffin / gist:170f132690a5376e5370
Created October 14, 2014 14:13
Return full post content (including HTML) for featured content addon in Soliloquy.
<?php
add_filter( 'soliloquy_fc_post_content', 'tgm_sol_full_post_content', 10, 2 );
function tgm_sol_full_post_content( $content, $post ) {
// Use the full post content.
return $post->post_content;
}
@thomasgriffin
thomasgriffin / gist:02f4ca3289bbc68d8e06
Created October 3, 2014 13:59
Force autoplaying, even on user interaction.
<?php
add_action( 'soliloquy_api_after_transition', 'tgm_soliloquy_force_auto' );
function tgm_soliloquy_force_auto( $data ) {
ob_start();
?>
soliloquy_slider['<?php echo $data['id']; ?>'].startAuto();
<?php
echo ob_get_clean();
@thomasgriffin
thomasgriffin / gist:91c8bb434bdf1087e8aa
Created September 18, 2014 14:42
Add caption to Sleek theme in Envira.
<?php
add_filter( 'envira_gallery_output_after_image', 'tgm_envira_gallery_themes_overlay', 10, 5 );
/**
* Adds custom HTML overlays for specific gallery themes.
*
* @since 1.0.0
*
* @param string $output String of gallery output.
* @param mixed $id The ID of the gallery.
* @param array $item Array of data about the image.
@thomasgriffin
thomasgriffin / gist:bb64bcb7dd3303ade782
Created September 16, 2014 18:51
Remove Soliloquy sliders from search results.
<?php
add_filter( 'soliloquy_post_type_args', 'tgm_soliloquy_remove_from_search' );
function tgm_soliloquy_remove_from_search( $args ) {
$args['exclude_from_search'] = true;
return $args;
}
@thomasgriffin
thomasgriffin / gist:0ef000448c7cb5903587
Last active August 29, 2015 14:06
Increase the post selection limit for "load exclusively on" and "never load on" to 5000 posts in OptinMonster.
<?php // Do not include this opening PHP tag!
add_filter( 'optin_monster_post_selection_limit', 'tgm_om_post_selection_limit' );
function tgm_om_post_selection_limit( $limit ) {
return 5000;
}
@thomasgriffin
thomasgriffin / gist:a50ed647cc910bc2d2f2
Created September 3, 2014 18:05
Disable "Powered by" link for all optins.
<?php
add_filter( 'optin_monster_save_optin', 'tgm_om_disable_powered_by_link' );
function tgm_om_disable_powered_by_link( $settings ) {
$settings['powered_by'] = 0;
return $settings;
}
@thomasgriffin
thomasgriffin / gist:f8b8e8a09178bbf0b774
Created September 2, 2014 18:20
Filter data before it is sent to Mailpoet.
<?php
add_filter( 'optin_monster_pre_optin_mailpoet', 'tgm_om_send_to_nimble', 10, 2 );
function tgm_om_send_to_nimble( $data, $lead ) {
// You would enter your code to send to Nimble here, probably using wp_remote_post. Uncomment to see the data provided.
//echo '<pre>' . var_export( $data, true ) . '</pre>';
//echo '<pre>' . var_export( $lead, true ) . '</pre>';
// Return the data so it can be sent to Mailpoet.
return $data;
@thomasgriffin
thomasgriffin / gist:2e7ddd446632d9a099cc
Created August 28, 2014 19:16
Custom success message for OptinMonster.
<?php
add_action( 'optin_monster_success_message', 'tgm_om_success_social' );
function tgm_om_success_social(){
echo '<div class="om-follow"><img src="' . plugins_url( 'assets/css/images/sidebar-logo@2x.png', Optin_Monster::get_instance()->file ) . '" alt="OptinMonster" style="display:block;margin:0 auto 15px;text-align:center;" width="260px" height="38px" /><p style="margin: 15px 0;font-size: 16px;line-height:20px;"><strong>Thanks for subscribing to OptinMonster. You will receive an email soon with your FREE case study increasing your conversion rates. Make sure to follow us on Twitter for all the latest updates to OptinMonster!</strong></p>';
echo '<a href="https://twitter.com/optinmonster" class="twitter-follow-button" data-show-count="false" data-size="large" data-dnt="true">Follow @optinmonster</a>';
echo "<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitte