How do I link to a dynamic ACF button from a Custom Post type?

I decided to rewrite my code and no longer use JS to open the Modal window, but pure CSS. I then attached the POST ID to the ID tag so that each modal window would be unique.

code for a tag below. Href matches the ID on modal div.

<a href="#open-modal-<?php echo $post->ID; ?>" class="button gallery-button">View Images</a>