Skip Navigation

[Resolved] Auto Populate 3rd Party Shortcode Value in CRED field Value

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.

This topic contains 3 replies, has 2 voices.

Last updated by Minesh 5 years, 3 months ago.

Assigned support staff: Minesh.

Author
Posts
#393528

I am trying to: Shortcode in shortcode value. Automatically populate a CRED field value with the value of a 3rd party shortcode

These are the related fields in my CRED post form. I use a 3rd party countdown timer that manually generates a very large shortcode including styling. The only thing that changes are start and end dates. I have to manually change the dates for each post, which is labor intensive. I need to parse date values to auto populate.

[cred_field field="deadline" post="deal" value="" urlparam=""]

[cred_field field="countdown-timer" post="deal" value="SKIP THIS - APPLIED BY AN ADMINISTRATOR" urlparam=""]

This is the countdown timer generated shortcode. I need to populate "startDate" with today's date and endDate with CRED deadline field date instead of having to set temporary value="SKIP THIS - APPLIED BY AN ADMINISTRATOR" and then editing the post to change the day values. What form javascript or theme function would I employ to achieve this? Thanks.

[circularcountdown task="update" startDate="2016/04/28 00:00:00" endDate="2016/05/11 16:00:00" timeZone="-8" past="false" margin="8" showDay="true" showHour="true" showMinute="true" showSecond="true" dayDiameter="140" hourDiameter="140" minuteDiameter="140" secondDiameter="140" dayBgWidth="17" hourBgWidth="17" minuteBgWidth="17" secondBgWidth="17" dayCircleWidth="17" hourCircleWidth="17" minuteCircleWidth="17" secondCircleWidth="17" dayBgColor="#ffff33" hourBgColor="#ffff33" minuteBgColor="#ffff33" secondBgColor="#ffff33" dayCircleColor="#45bc00" hourCircleColor="#00a3bc" minuteCircleColor="#7600bc" secondCircleColor="#bc1800" dayCounterFontSize="48" hourCounterFontSize="48" minuteCounterFontSize="48" secondCounterFontSize="48" dayTextFontSize="14" hourTextFontSize="14" minuteTextFontSize="14" secondTextFontSize="14" dayCounterFontColor="#404040" hourCounterFontColor="#404040" minuteCounterFontColor="#404040" secondCounterFontColor="#404040" dayTextFontColor="#404040"
hourTextFontColor="#404040" minuteTextFontColor="#404040" secondTextFontColor="#404040"
dayText="Days" hourText="Hours" minuteText="Minutes" secondText="Seconds" dayTextMarginTop="4" hourTextMarginTop="4" minuteTextMarginTop="4" secondTextMarginTop="4"]

#394102

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

What if you should try to add custom shortcode that will return the start date and end date values and you should add custom shortcode to value attribute of your CRED field shortcode.

For example:

[cred_field field="countdown-timer" post="deal" value="[get_enddate_value]" urlparam=""]

Please note that CRED saves post expiratoin in postmeta table with mety key "_cred_post_expiration".

#403198

Not sure I understand. All I need to dynamically change in the countdown timer shortcode is two pieces of data. How does this apply when the field "deadline" is the end date and the start date is the post's publish date? Thanks.

#403331

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As I understand - you want to update field "countdown-timer". If this is true:
Have you checked CRED API hook: "cred_save_data"
https://toolset.com/documentation/user-guides/cred-api/#csd

This hook allows doing a custom action when post data is saved to database. So you can update the
"countdown-timer" value with your shortcode value.

Also I would like to know where you are using this shortcode: "[circularcountdown]"? I need to understand the flow of your request so that I can guide you in right direction.