0

I have a query related to Dynamic hidden field to be set in Contact form 7

I want to set current date as dynamic hidden field in contact form. Any Help.

My code is "[dynamichidden post_date "post_date"]"

I am using contact form7 and Contact Form 7 - Dynamic Text Extension

Thank you

2 Answers 2

3

You can create a shortcode which will return current date and add that shortcode in contact form as follows -

Create shortcode in functions.php file

function custom_post_date_callback(){
    return current_time('mysql');
}

add_shortcode('custom_post_date', 'custom_post_date_callback');

In post or page you will need to add shortcode as follows -

[dynamichidden post_date "custom_post_date"]

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for answer let me check
1

I thing you to get current date you have to create shortcode...

put this function in functions.php

function displaydate(){
return date('F jS, Y');
}
add_shortcode('date', 'displaydate');

you can change date format as you wanted...

put this date shortcode without bracket in dynamic value field in dynamichidden input field..

check this image http://dev.savivatech.com/sa/wp-content/uploads/2017/07/current-date.png

[dynamichidden dynamichidden-693 "date"]

this dynamichidden-693 is dynamic name...

Hopes this will help you

3 Comments

Thank you for answer let me try
if it useful means please upvote.. correct means check correct answer..
Sure i will do it for you

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.