I made a WordPress Loop to put custom posts (members) with custom fields on one of my pages. The custom fields are name, image, and description, but I only display image and name on the page. I want to be able to click on a post and see a lightbox pop up, showing all the custom fields. I believe this requires a click event through jQuery and some WordPress custom post data wrangling, but I’m not sure how to go about this.
How can I access the custom fields for the post that I click on? This, obviously, is now out of the loop because everything now depends on what I click on.
I was thinking of doing this for a click event:
<?php $variable = get_field('field_name'); echo $variable; ?> but is this supposed to work outside the loop? I tried but no dice.
Any support would be appreciated – thank you in advance!