Atenção!

Este artigo contém código PHP e destina-se a desenvolvedores. Oferecemos este código como uma cortesia, mas não fornecemos suporte para personalizações de código ou desenvolvimento de terceiros.

Para orientação extra, consulte o tutorial do WPBeginner sobre como adicionar código personalizado.

Dispensar

Descrição

The wpforms_wp_footer_end action that is triggered at the end of the page load only if a form created with WPForms is found on the page and when all other scripts are loaded.

Parâmetros

Esta ação não aceita nenhum parâmetro.

Mais Informações

This action will run at the end of the page load, but specifically for the wpforms_wp_footer_end action, it will only fire if there is a form created with WPForms found on that page and only when all other scripts are loaded.

This is especially useful if you have any custom JavaScript or custom CSS on the page but you don’t want that code to run if there isn’t a WPForms on the page.

Fonte

wpforms/src/Frontend/Frontend.php

Exemplos

This example is pulled from a snippet reference (link shown below) and it’s using Javascript and the wpforms_wp_footer_end action to disable the scroll animation on multi-page forms.

/**
 * Change the captcha theme for the Google Checkbox v2 reCAPTCHA
 *
 * @link https://wpforms.com/developers/how-to-change-the-captcha-theme-on-google-checkbox-v2-recaptcha/
 */
 
function wpf_dev_change_captcha_theme( ) {
?>

<script type="text/javascript">

    jQuery(function($){

        $( '.g-recaptcha' ).attr( 'data-theme', 'dark' );

    });

    </script>

<?php
}

add_action( 'wpforms_wp_footer_end', 'wpf_dev_change_captcha_theme', 30 );

Just one of the many ways to use the wpforms_wp_footer action on your site.

Artigos de Referência