Skip Navigation

[Resolved] "date of the day" variable

This support ticket is created 3 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 5 replies, has 2 voices.

Last updated by fabriceS 3 years, 3 months ago.

Assisted by: Jamal.

Author
Posts
#2125537

Hi,

I'm using a form to send info requests.
The titles os each of these posts should display the post-title and the date of the day.

For the moment I have this line of code:
[cred_field field='post_title' value='[wpv-post-title] - [wpv-post-date]']

But I'd like to replace [wpv-post-date] by the date of the day where the info request is sent.

Which variable should I use ?

Thanks for your help.

Best regards,

Fabrice

#2125579

Hello Fabrice and thank you for contacting Toolset support.

The following shortcodes are not guaranteed to return the information from the request:

[wpv-post-title] - [wpv-post-date]

If the form is placed inside a post's content template, it will return the information from that post. If the form is placed on a page, it will return the information from that page.

So, to better help you with this request, I prefer to take a closer look at your website and see where the form is used. That way, I will give accurate advice. If you agree, your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

Please let me know where the form is used, or share a URL where I can see the form in the frontend.

#2126537

Thank you, I confirm that the credentials are working.

However, I'll also need to know where the form is used. Because that will affect the output of the shortcodes?
Is it used inside a content template? What content template?
Is it used inside a page/post? What is it?
Can you share a URL where we can see the form in the frontend?

#2126555

I understand.

For the moment it is used only on every project pages like this one:

hidden link

#2126633

Because the form is shown inside projects' single post pages, the shortcodes will return data from the project. You will get the project's title, and the project's created date. If you need the current date, you will have to create a shortcode for it. Check an example here https://toolset.com/forums/topic/display-current-date-in-view-or-cred-form/#post-477276

However, instead of generating the title using a shortcode, I would suggest using custom code to hook into the form submission process and update the title programmatically. Check an example here https://toolset.com/forums/topic/auto-populate-parent-title-and-date-as-child-content-title/#post-1285213
The next reply on that forum thread is also interesting, please take the time to read it.

Read more about the cred_save_data action here https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

If you are still unsure what solution to implement, let me know and I'll help with the custom code.

#2127517

My issue is resolved now. Thank you!