I am trying to render content generated by a php file in [jQuery Colorbox][1] through AJAX in my WordPress site. The PHP resides on the same server in the same domain. It works perfect when I run it on localhost but it’s not working on the server.
Here is the link to my site – http://shabdcreatives.com/portfolio
The links themselves are not invalid, for example the following link works fine on its own:
http://shabdcreatives.com/wp-content/plugins/catgrid/includes/CatGridPost.php?ID=33
I just won’t open inside the colorbox.
Also the php file I am trying to load is just a fragment and DOES NOT CONTAIN any or tags.
I tried the colorbox support group but no replies from them yet
This is the code in the CatGridPost.php file that i am calling in the colorbox.. i tried calling a plain text file too… it returned no error.. but the colorbox did not show its contents either
require_once("../../../../wp-blog-header.php");
$thepost = get_post($_GET["ID"]);
$thecontent = $thepost->post_content;
$thetitle = $thepost->post_title;
$thelink = get_permalink($_GET["ID"]);
?>
<div id="cg-post-container">
<div id="cg-post-title">
<a href="<?php echo $thelink; ?>"><?php echo $thetitle; ?></a>
</div>
<div id="cg-post-content">
<?php echo $thecontent; ?>
</div>
</div>
You should not load wp-blog-header.php yourself.
Use
wp-admin/admin-ajax.php
instead, as described here:http://codex.wordpress.org/AJAX_in_Plugins