Skip to content

Instantly share code, notes, and snippets.

@New0
Created June 30, 2018 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save New0/435f41907de2edd1292b1849c7d0456b to your computer and use it in GitHub Desktop.
Save New0/435f41907de2edd1292b1849c7d0456b to your computer and use it in GitHub Desktop.
Custom plugin to filter Direct Stripe button markup
<?php
/*
* Plugin Name: Direct Stripe Custom Button
*/
//Set Styles settings not to use custom or Stripe styles
//Filters added in Direct Stripe 2.1.5 ( List of Actions and filters https://newo.me/direct-stripe-actions-and-filters-hooks/ )
add_filter('direct_stripe_div_before', function( $div, $button_id, $class ){
if( $button_id !== 'MyButtonID'){ //Set a Button ID in the Button Settings to target only this Button
return $div;
}
$div = '<div class="thrv_wrapper thrv-button ' . $class .'" data-css="tve-u-16446cb2f5e" data-tcb_hover_state_parent="" data-button-style="rounded">';
return $div;
}, 10, 3);
add_filter('direct_stripe_button', function( $button, $instance, $button_id, $class ){
if( $button_id !== 'MyButtonID'){ //Set a Button ID in the Button Settings to target only this Button
return $button;
}
$button = '<span class="tcb-button-texts"><span data-id="' . $instance .'" class="tcb-button-text thrv-inline-text ' . $class .'" data-css="tve-u-16446c6de11">Sign Me Up!</span></span>';
return $button;
}, 10, 4);
@lLavoy316
Copy link

lLavoy316 commented Dec 25, 2019

i dont no a little confused probably have to redo later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment