Home › Forums › Calendar Products › Events Calendar PRO › Using post ID in month tooltip & mobile view
- This topic has 3 replies, 4 voices, and was last updated 7 years, 3 months ago by Dawn Minch-Cat.
-
AuthorPosts
-
January 17, 2017 at 9:34 am #1219694Dawn Minch-CatParticipant
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
January 18, 2017 at 12:54 pm #1220436NicoMemberHi 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,
NicoFebruary 9, 2017 at 8:35 am #1232069Support DroidKeymasterHey 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 -
AuthorPosts
- The topic ‘Using post ID in month tooltip & mobile view’ is closed to new replies.