Make page available with two different templates? (2 posts)

  1. Scott Buckingham
    Posted 6 years ago #

    Hey peeps,
    I'm working on a WP site for a web development firm, and they have a Portfolio section. Pages in the portfolio have custom fields and gallery images. This information is displayed using a portfolio-page.php template, and is looking great.

    What I'd like to do is load sections of a portfolio item (thumbnail, title, and custom fields) via AJAX when a user hovers a link to a portfolio page. I've got all of the JavaScript working, but what I need now is to find a way to display the portfolio page with a different template if it's being called from the JavaScript.

    So, I basically want
    to load using a different template than what's set in WP.

    Anyone know how I might be able to do this?


  2. Scott Buckingham
    Posted 6 years ago #

    Ok, so I figured it out about 2 minutes after I posted the question...

    I ended up just adding an if statement to portfolio-page.php that checks if $_GET['popup'] is set. If it is, it displays minimal info.

    The JS functions then just add ?popup to the url before making the AJAX call.

    So simple. So elegant.

Topic Closed

This topic has been closed to new replies.

About this Topic