I have a template portfolio-modal.php that builds the html for a post’s modal window.
I can load the php template from functions.php
function ajaxPortfolioItem(){
//get the data from ajax() call
$postID = $_GET['postID'];
$portfolioItem = get_template_part('portfolio','modal');
die($portfolioItem);
}
add_action( 'wp_ajax_ajaxPortfolioItem', 'ajaxPortfolioItem' );
But how can I pass the $postID to the template, so it can render the right post?
This seems like something I’ve seen a million themes do, but I’ve searched all over and can’t find an answer.
P.S. I’m not a WP guy, so maybe I’m approaching this wrong.
On a theme I’m working on now I’m loading a specific page on click event with this
Then you just have to create a page in WP, and add a link to this page in your theme.
When you click
YourOpeningButtonit should check the href and open this page inYourContainer. I hope it helps…