WordPress.org

Ready to get started?Download WordPress

Forums

Parse error in custom function for Gravity Forms (2 posts)

  1. rbmg-wp
    Member
    Posted 9 months ago #

    Hello,

    PHP newbie here. Have tried to write a custom function for use with Gravity Forms. Have created a child them and that's all good.

    Purpose of function: to take a value from a date picker field and return what day of the week it is.

    Have added this into functions.php and added to child theme:

    <?php
    /**
     * Use Gravity Forms Conditional Logic with Dates
     */Returns day of week of selected date
    
    add_filter("gform_field_value_dayofweek", "liz_populate_dayofweek");
    function liz_populate_dayofweek( $value ){
        $timestamp = (strtotime($value))
        $day = date('l', $timestamp);
        return $day;
    }
    ?>

    Which gives the following error:
    : syntax error, unexpected T_STRING in ...line 4 of child theme functions.php

    Can anyone help me out here please?
    Many thanks!!

  2. rbmg-wp
    Member
    Posted 9 months ago #

    NB, I have just noticed the missing semi-colon on line 3 and fixed it but it makes no difference.

Reply

You must log in to post.

About this Topic