Skip to content

Instantly share code, notes, and snippets.

@davidwolfpaw
davidwolfpaw / gravity-forms-confirmation-remain.php
Last active July 2, 2025 08:04
Keep Gravity Forms Displayed After Submission
<?php
// Allow the Gravity form to stay on the page when confirmation displays.
add_filter( 'gform_pre_submission_filter', 'dw_show_confirmation_and_form' );
function dw_show_confirmation_and_form( $form ) {
// Inserts a shortcode for the form without title or description
$shortcode = '[gravityform id="' . $form['id'] . '" title="false" description="false"]';
// Ensures that new lines are not added to HTML Markup
ob_start();
@igorbenic
igorbenic / functions-2.php
Last active July 31, 2022 22:26
How to Move Payments on WooCommerce Checkout | https://www.ibenic.com/move-payments-woocommerce-checkout
<?php
/**
* Adding the payment fragment to the WC order review AJAX response
*/
add_filter( 'woocommerce_update_order_review_fragments', 'my_custom_payment_fragment' );
/**
* Adding our payment gateways to the fragment #checkout_payments so that this HTML is replaced with the updated one.
*/
function my_custom_payment_fragment( $fragments ) {
@dangoodman
dangoodman / functions.php
Created April 10, 2020 17:46
WooCommerce: allow HTML in shipping option labels
<?php
// Paste everything below this line to your child-theme's functions.php file.
// Cancel sanitizing for all shipping option labels starting with 'HTML:'.
remove_filter('woocommerce_shipping_rate_label', 'sanitize_text_field');
add_filter('woocommerce_shipping_rate_label', function($label) {
if (substr_compare($label, 'HTML:', 0, 5) === 0) {
$label = ltrim(substr($label, 5));
}
@ideadude
ideadude / pmpro_allow_weak_passwords.php
Created May 12, 2020 21:18
Tell PMPro allow weak passwords on the change password and reset password forms.
/**
* Tell PMPro allow weak passwords on the change password and reset password forms.
* Requires PMPro v2.3.3+
*/
add_filter( 'pmpro_allow_weak_passwords', '__return_true' );
@xavierlopez
xavierlopez / functions.php
Last active November 15, 2021 07:21
How to get related course from product (LearnDash WooCommerce integration)
//Here we get an array of related LearnDash courses related to a WC_Product
$courses_id = get_post_meta( $product->get_id(), '_related_course',true);