I
I
igix2018-04-28 13:22:50
JavaScript
igix, 2018-04-28 13:22:50

How to pass post id to modal window in php code?

Kind.

When you click on a post, a modal window opens.

Code in modal window.

<?php 
$id = 70;
echo do_shortcode( ''.get_field('slider_exercises', $id).'' ); 
?>

The code displays the gallery from the post via the ACF plugin. If you do not specify the $id of the post, then the gallery will not be displayed.
JS when clicking on a post takes the id of the post and places it in any specified attribute of the modal window.
How can I put this id into the $id variable of the php code, or how can I extract the id number from the html attribute with php code.
Or maybe there is another way?

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
leni_m, 2018-04-28
@igix

i.e. you manually specify the $id to display some post now?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question