Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

160
Vistas
Gravity Form - expiration date with year

I need help with this code. This code's output is example "21st of June". I would like to add year on that. How can I insert that in the code as I got an invalid code when I added the 'Y':)

add_filter( 'gform_field_value', 'all_the_dates', 10, 3 );
function all_the_dates( $value, $field, $name,  ) {
    // "21st of June" is the format we want
    $local_timestamp = GFCommon::get_local_timestamp( time() );
    $expiration_timestamp = ( 86400 * 182 ) + $local_timestamp;
    $today = date_i18n( 'jS \of F', $local_timestamp, true );
    $expiration = date_i18n( 'jS \of F', $expiration_timestamp, true );
    $values = array(
        'todays_date' => $today,
        'three_days'  => $three,
        '182_days'  => $expiration,
    );
    return isset( $values[ $name ] ) ? $values[ $name ] : $value;
}

Appreciate any input as soon as anyone can :) Thank you!!!

Cheers, Liza

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think your error is coming from the fact that $three is undefined: 'three_days' => $three, Remove that line and see if your site still receives an error.

add_filter( 'gform_field_value', 'all_the_dates', 10, 3 );
    function all_the_dates( $value, $field, $name,  ) {
        // "21st of June" is the format we want
        $local_timestamp = GFCommon::get_local_timestamp( time() );
        $expiration_timestamp = ( 86400 * 182 ) + $local_timestamp;
        $today = date_i18n( 'jS \of F Y', $local_timestamp, true );
        $expiration = date_i18n( 'jS \of F Y', $expiration_timestamp, true );
        $values = array(
            'todays_date' => $today,
            '182_days'  => $expiration,
        );
        return isset( $values[ $name ] ) ? $values[ $name ] : $value;
    }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda