title: Pass Wordpress Post ID To Another Page
body: <p>Hey going to explain what I am looking for this code to do. Hopefully someone smarter than me can help clean it up and put it together.</p>
  
  <p>What I want to accomplish in general:</p>
  
  <p>I have a image on a wordpress page and when it is clicked it will open a custom php file in a div on that page that displays a specific wordpress post based on the post ID.</p>
  
  <p>Trying to get the script to work, but some things I am unsure of how to put together correctly.</p>
  
  <p>This is what I have now:</p>
  
  <p>The image link is essentially passing the URL of the post I want to load in the div. So first thing I need is the script to take the url of the post and get the post ID so the custom page can use it.</p>
  
  <p>First Line gets the link from the image link. Second line would get post ID from URL. Not sure if this is 100% correct. Not sure if variable will work like that? It works on a page if I input the url manually.</p>
  
  <pre><code>var post_link = $(this).attr("href");
  $post_id = url_to_postid($post_link);
  </code></pre>
  
  <p>This is what I have for the whole thing:(Doesn't work, just an example of what I am trying to accomplish)</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  jQuery.noConflict();
  jQuery(document).ready(function($){
      $.ajaxSetup({cache:false});
      $("a.ajax").click(function(){
          var post_link = $(this).attr("href");
          $post_id = url_to_postid($post_link);
          $("#tabs").html("loading...");
          $("#tabs").load(custom-page.php);
          return false;
      });
  });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I am not sure the best way to pass the id variable so the custom php page can use it to load that post in the div. That part is missing.</p>