• I am trying to get a dynamic startDate – which updates dynamically every Tuesday at 18:00.

    I found a shortcode using ‘WP Date and Time Shortcode’ which does that perfectly:

    [wpdts-custom format="Y-m-d" next="TUE 18:00"]

    I can insert this code into another shortcode plugin called ‘Shortcoder’ and it displays correctly.

    I tried to insert the shortcode above into the ‘Add to Calendar Button’ startDate=”” field but it does not work. Any help to make this work would be greatly appreciated.

    Thanks so much in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Add to Calendar

    (@add2cal)

    When using the button via its shortcode option, you can use a shortcode inside the shortcode.

    However, you would need to use {sc_start}xxx{sc_end} instead of [xxx] as scheme!

    Like [add-to-calendar-button startDate=”{sc_start}wpdts-custom format=”Y-m-d” next=”TUE 18:00″{sc_end}”]

    Thread Starter andi_sf

    (@andi_sf)

    Hello – thank you for the feedback.

    I tried it out with:

    [add-to-calendar-button name="My Test Button" startDate="{sc_start}wpdts-custom format='Y-m-d' next='TUE 18:00'{sc_end}" startTime="18:00" endTime="19:00" trigger="click" timeZone="America/Los_Angeles" location="Location 1" description="Description here" options="'Apple','Google','iCal','Outlook.com','Microsoft365','Yahoo'" size="5"]

    but the button still will not display. If I put in a regular date for startDate (XXX-XX-XX) in the above shortcode it works – but with the nested shortcode it fails and the button does not display.

    Any help would be appreciated

    Plugin Contributor Jens Kuerschner

    (@jekuer)

    If you add the “debug” attribute, what does it tell you?

    Have you a page, where I can have a look at the not appearing button?

    Thread Starter andi_sf

    (@andi_sf)

    I added the ‘debug’ attribute but nothing is displayed. If I place the ‘not appearing’ button in the page and inspect the code nothing is rendered. So it looks like the button code fails to execute.

    Would it be possible to install the ‘WP Date and Time Shortcode’?plugin into your WordPress testing site and test it out from your end?

    Thanks again.

    Plugin Contributor Jens Kuerschner

    (@jekuer)

    We just released a new patch version (2.3.8), which adds more sanitization to the shortcode-in-shortcode. This should ensure there does not get any breaking code infused by the shortcode.

    I tried to reproduce. The only thing I found: Could it be that there is a line break in your code? This breaks any shortcode!

    Thread Starter andi_sf

    (@andi_sf)

    Hi Jens,
    thanks for the reply – it still won’t work. When I enter for the startDate:

    startDate="{sc_start}wpdts-custom format='Y-m-d' next='TUE 18:00'{sc_end}"

    which means the date updates weekly on Tuesday at 6pm.

    I get an error:

    Error: Add to Calendar Button generation (atcb-btn-1) failed: date misspelled [-> YYYY-MM-DD]

    I also just put the date in manually and then it executes which means there are no line breaks that could cause the issue. Does this help to troubleshoot from your side?

    Plugin Contributor Jens Kuerschner

    (@jekuer)

    Ok. This is somehow good. It means that there is no complete break of the widget. The other shortcode simply does not return the correct format.

    You could use the wpdts-custom shortcode separately ([wpdts-custom format='Y-m-d' next='TUE 18:00']) to see what it prints. It needs to match the shown format.

    Thread Starter andi_sf

    (@andi_sf)

    Hi Jens,

    thanks for your reply.

    The shortcode [wpdts-custom format=’Y-m-d’ next=’TUE 18:00′] prints:
    2024-08-06

    and this is exactly what I input when I would put in the date manually. Could it be that the ‘wpdts-custom’ shortcode (‘WP Date and Time Shortcode’?plugin) wrapped in {sc_start}…{sc_end} does not execute at all but is read as text only?

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.