Post repeated when opening in overlay, how do I solve this? [closed]

to be able to identify a specific “post” you need to have some unique attribute in its HTML. Usually the easiest thing to do is to use the post id as part of the id attribute (in your case maybe something like overlay{$post_id}). I personally started to prefer to use data- style attributes instead but for this use case the difference is more of esthetics than anything else.

Now that you have everything unique (and maybe even instead of doing that at all), either use a common class on all the “posts” and have a handler for click on elements with that class (easy with jQuery), or add a click handler on the containing div instead of the elements, and in the handler look at the event properties to find out which “post” was actually clicked.

tech