Add Featured Images to RSS Feeds

/** * Add the post thumbnail, if available, before the content in feeds. * * @param string $content The post content. * * @return string */ function wpcode_snippet_rss_post_thumbnail( $content ) { global $post; if ( has_post_thumbnail( $post->ID ) ) {…Continue reading

WP Simple Pay: Use Custom Field Value as Stripe Payment Description

/** * @link https://library.wpcode.com/snippet/e5wnp95d/ */ add_filter( ‘simpay_get_paymentintent_args_from_payment_form_request’, /** * @param array $paymentintent_args Arguments for PaymentIntent. * @param SimplePay\Core\Abstracts\Form $form Form instance. * @param array $form_data Form data generated by the client. * @param array $form_values Values of named fields in…Continue reading

WP Simple Pay: Custom Server-Side Validation Before Payment Creation

/** * @link https://library.wpcode.com/snippet/ro8wgkow/ */ add_action( ‘simpay_before_payment_create’, /** * @param \WP_REST_Request WordPress REST API request. */ function( $request ) { // “Stripe Metadata Label” of the custom field. $custom_field_name = ‘Customer DOB’; // Retrieve form values. $fields = $request->get_param( ‘form_values’…Continue reading

WP Simple Pay: Conditionally Dequeue Scripts & Styles

/** * @link https://library.wpcode.com/editor/e5wn795d/ */ add_filter( ‘simpay_before_register_public_scripts’, /** * @var array $scripts * @return array $scripts */ function( $scripts ) { // Do not load any scripts unless the user is on one of these pages. if ( ! is_page(…Continue reading

WP Simple Pay: Hide reCAPTCHA Badge

/** * @link https://library.wpcode.com/snippet/ro8w3kow/ */ add_action( ‘simpay_form_before_form_bottom’, function() { ?> This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.Continue reading

WP Simple Pay: Create WordPress User After Payment

/** * @link https://library.wpcode.com/snippet/3234p8or/ * * @param \Stripe\Event $event Stripe Event. * @param \Stripe\Subscription|\Stripe\PaymentIntent $object Stripe Subscription or PaymentIntent */ function simpay_custom_create_user( $event, $object ) { $email_address = $object->customer->email; // Don’t create duplicate records. if ( false !== username_exists( $email_address…Continue reading

WP Simple Pay: Create WordPress User After Payment (Lite)

/** * @link https://library.wpcode.com/snippet/32j68l5l/ */ add_action( ‘simpay_payment_receipt_viewed’, /** * @param array $payment_confirmation_data { * Contextual information about this payment confirmation. * * @type \SimplePay\Vendor\Stripe\Customer $customer Stripe Customer * @type \SimplePay\Core\Abstracts\Form $form Payment form. * @type array $subscriptions Subscriptions associated with…Continue reading