Attention !

Cet article contient du code PHP et est destiné aux développeurs. Nous fournissons ce code à titre de courtoisie, mais nous n'offrons pas de support pour les personnalisations de code ou le développement tiers.

Pour obtenir de l'aide supplémentaire, veuillez consulter le tutoriel de WPBeginner sur l'ajout de code personnalisé.

Ignorer

Description

The wpforms_form_pages_content_before action fires before a form is displayed on the site’s frontend, and the form was created with the Form Pages addon.

Paramètres

This action does not accept any parameters.

Plus d'informations

The wpforms_form_pages_content_before only fires for forms created with the Form Pages addon. It executes early on in the output rendering process.

An alternate action to consider is wpforms_form_pages_content_after, as it functions similarly.

Source

wpforms-form-pages/templates/single-form.php

Exemples

In this example, we’re going to post a link to our full digital catalog prior to displaying the form.

/**
 * Output something before your Form Pages form(s) using the Fires before a form is displayed on the site’s frontend, only if the form exists, contains fields, and was created with the <strong>Form Pages</strong> addon.
 action.
 * 
 * @link  https://wpforms.com/developers/wpforms_form_pages_content_before/
 */
function wpf_dev_form_pages_content_before( ) {
      
  
    // Run code or see example echo statement below.
    _e( 'If you would like to download our digital catalog, <a href="http://yourlinkurl.com/" target="_blank">click here</a>.', 'plugin-domain' );
  
}
add_action( 'wpforms_form_pages_content_before', 'wpf_dev_form_pages_content_before');
using the wpforms_form_pages_content_before action, you can output something before the form is displayed