Using post ID in month tooltip & mobile view

Home Forums Calendar Products Events Calendar PRO Using post ID in month tooltip & mobile view

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1219694
    Dawn Minch-Cat
    Participant

    Hey support!

    I know this is out of scope likely, but wondering if you could lend some insight on why I can’t seem to use a posts ID in the Month tooltip & mobile views.

    I’m adding some php to the file, so not using the javascript templating engine because I’m doing a lot of conditional logic based on custom fields and including that globally to a few templates, so that I can edit in one spot.

    For some reason this works but all the events show the same data. Titles still remain, but venue and condtionals show through each event as if they are all the same post.

    Any ideas? I’ve tried resetting post_data and even using the template engine to assign the ID to a variable. It always fails to loop through each event.

    Gist: https://gist.github.com/bmoredrew/568a6cf97f03f14744f85b63884d3f3e

    #1220436
    Nico
    Member

    Hi there,

    Thanks for reaching out to us on this! As you say we can’t help much with custom code but I can surely inspect the file and give you a hand 🙂

    So after checking the code the reason why it’s not working it’s pretty simple. The ‘tooltip.php’ view files is only printed out once in the document (the php will only be executed once), and it’s used as a ‘reusable’ template.

    Basically when you hover an event in month view, JS creates a copy of the ‘tooltip template’ printed out in ‘tooltip.php’ and populates it with the data passed by the data attribute ‘data-tribejson’ (the file generating this is ‘month/single-event.php’). So if you need to pass new variables to the template you’ll need to add that to the ‘data-tribejson’ attribute and then you it in the template. The explanation for this is commented in ‘month/single-event.php’.

    I understand the need to use PHP you have but it’s maybe easier to just create a simple printed tooltip in ‘month/single-event.php’ for each event, and override the JS actions to display this tooltip instead.

    Please let me know your thoughts about this,
    Best,
    Nico

    #1232069
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Using post ID in month tooltip & mobile view’ is closed to new replies.