### [wpforms_frontend_output](https://wpforms.com/developers/wpforms_frontend_output/)

**Published:** October 23, 2019
**Author:** Editorial Team

**Excerpt:** The wpforms_frontend_output action runs before a form is displayed on the site's frontend, and will only fire if the form exists and contains fields.

**Content:**

## Description

The `wpforms_frontend_output` fires before a form is displayed on the site’s frontend and inside the HTML form container. It will only fire if the form exists and contains fields.

## Parameters

$form\_data*(array)* Processed form settings/data, prepared to be used later.$form*(WP\_Post)* Form post type.## Source

`wpforms/src/Frontend/Frontend.php`

## More Information

While `wpforms_frontend_output` only fires for valid non-empty forms, it executes early on in the output rendering process. However, what you place with this action will be displayed inside the HTML `form` container.

An alternate action to consider is [wpforms\_frontend\_output\_before](https://wpforms.com/developers/wpforms_frontend_output_before/ "The wpforms_frontend_output_after action"), as it functions similarly, except it will be outside of the HTML form container.

## Examples

In our example, we have a form that will be taken down on Christmas day. We want to display a message above the form that will calculate today’s date less Christmas day and give the user a count of how many days are left to submit the form.

```

/**
 * Output something before your form(s).
 * 
 * @link  https://wpforms.com/developers/wpforms_frontend_output/
 *
 * @param array   $form_data Form data and settings.
 * @param object  $form      Form post type.
 */

function wpf_dev_frontend_output( $form_data, $form ) {

    // Optional, you can limit to specific forms. Below, we restrict output to
    // form #898.
    if ( absint( $form_data[ 'id' ] ) !== 898 ) {
    return;
    }

	// Set the PHP timezone
	date_default_timezone_set( 'America/New_York' );

	// Set the variable to Christmas day
	$christmasDay = strtotime( 'December 25' );

	// Get the current date
	$time = time();

	// Calculate how many days from today's date to Christmas day	
	$days = ceil(($christmasDay - $time)/60/60/24);

	echo ' ' . __( 'This contest closes on 12/25/2024, enter now! There are only ', 'text-domain' ) . $days . __( ' days left to enter!', 'text-domain' ) . '';
	
}

add_action( 'wpforms_frontend_output', 'wpf_dev_frontend_output', 10, 2 );

```

## Reference Articles

[How to Display Remaining Entry Limit Number](https://wpforms.com/developers/how-to-display-remaining-entry-limit-number/ "How to Display Remaining Entry Limit Number")

**Categories:** Actions Hooks

**Tags:** PHP

---

