I
I
igix2018-04-27 14:29:56
WordPress
igix, 2018-04-27 14:29:56

How to pass data from WordPress post content with ajax to fancybox modal window?

Good afternoon.

I put the layout on Wordpress.
I display posts from a certain category on the page. When you click on a post (a post in the a tag), a
fancybox modal opens. The modal window code is in the same page file at the top.
The modal window displays the video and the title of the post.
I plan to upload the video code through the Advanced Custom Fields (ACF) plugin in the post.

I was looking for information and realized that I need to display data via ajax. There are no ready-made examples in my case, and to collect
from other examples - there is not enough knowledge.

1 - I need that when clicking on a post, the data (title, video from an additional field (ACF) ) is substituted into the fancybox modal window.
2- Do I need to create a separate php file with modal window code?

Write PLEASE a working example.

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene Chefranov, 2018-04-27
@igix

Why do you need AJAX? Display your video/title or whatever in data attributes or blocks, and then hide it with CSS. And on click, read data from attributes or show a hidden block

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question