• Resolved mwgideon

    (@mwgideon)


    I’m experimenting with this plugin and trying to incorporate it with a event custom post type, that utilizes the Advanced Custom Fields plugin (ACF) – I’m trying to use the Add To Calendar plugin, where the <add-to-calendar-button> details are populated automatically based on the fields I have setup. For example – I have an ACF field called “event_date” – I’d like that entry to auto populate in the startDate field. I’ve tried this:

    startDate=<?php echo the_field(‘event_date’); ?> – but this appears to break the code as the buttons no longer appear.

    I’ve also tried this:

    name=<? php echo the_title(); ?> – which seems to partially work, but it only shows the first word, if there is a space in the title anything after that doesn’t show up.

    I’m hoping to make this work, but it may not be possible. I did post this question on stackoverflow, which shows my shortcode if that helps with more detail – https://stackoverflow.com/questions/76268092/add-to-calendar-button-plugin-and-shortcode

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Jens Kuerschner

    (@jekuer)

    Using quotes should get this to work.

    Like <php echo '"' . the_title() . '"'; ?>

    What also helps here: Add the debug option by simply adding the attribute “debug” to the tag. It would give you more information, if something goes wrong.

    Thread Starter mwgideon

    (@mwgideon)

    I try your suggestion (see below), but the results are the same. Only the first word of the tile shows up.

    name=<? php echo ‘”‘ . the_title() . ‘”‘; ?>

    Here’s the test page I am just trying it out on – https://www.hampsteadbc.org/test/

    Not sure how to put the debug attribute to the tag, but will try if you have an example. Thanks..

    Plugin Contributor Jens Kuerschner

    (@jekuer)

    Your test page is not working, unfortunately.

    I made it a unnecessarily complicated. You could also simply go for name="<?php echo the_title(); ?>" – again, mind the quotes, but you do not need to create them with echo.

    The debug option would go like this:

    <add-to-calendar-button debug name="abc" startDate="....

    Thread Starter mwgideon

    (@mwgideon)

    Thanks so much, I was able to play around with it some more and got it working, the issue with the time ended up being the ACF field not being in the correct display format. Here is what I used to pull in the ACF field information:

    startTime=”<?php echo the _field(‘event_start_time’); ?>”

    Thread Starter mwgideon

    (@mwgideon)

    issue resolved, see above message – thanks for all of the help..

    Plugin Contributor Jens Kuerschner

    (@jekuer)

    Awesome! All the best.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘event details generated off Custom Post Type fields’ is closed to new replies.