Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8811859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:27:58+00:00 2026-06-14T03:27:58+00:00

I have a template portfolio-modal.php that builds the html for a post’s modal window.

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:28:00+00:00Added an answer on June 14, 2026 at 3:28 am

    On a theme I’m working on now I’m loading a specific page on click event with this

    $(".YourOpeningButton").click(function(){
            var post_link = $(this).attr("href");
            $("#YourContainer").html("loading...");
            $("#YourContainer").load(post_link + " #container > * ");
        return false;
        });
    

    Then you just have to create a page in WP, and add a link to this page in your theme.

    <a href="<?php echo get_option('home'); ?>/YourPage/" class="">link</a>
    

    When you click YourOpeningButton it should check the href and open this page in YourContainer. I hope it helps…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a template in joomla without index.php I only have index.html, css file,
I have created a custom post type of 'portfolio' and page with a template
I have been unable to get my single-portfolio.php template to behave properly. So I
I have template for example index.html.php where I use php assetic loader like this
i have template base.html and some children templates. I don't know how to set
I have template that looks like this: 100 template<size_t A0, size_t A1, size_t A2,
I have a template class method like that: template<class T> static tmpClass<T>* MakeInstance(T value)
I have Template and two snippets. Can I get Id in Template for select
I have a template class that is: template <class identifier,class registeredObject> class FxPairRegistry :
I have template class ItemContainer that actually is facade for a whole family of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.