I am developing a plugin which displays a wordpress post in a lightbox outside the loop. I noticed that some plugin which modify the contents of the post (like Facebook Like button plugin) use the get_permalink()
function to retrieve post urls. When the post is opened normally (single.php) the plugins work fine. When the post is opened in the lightbox (outside the loop) , the plugins dont work since get_permalink()
in the plugin does not return anything. however if i can somehow apply filter and return get_permalink($post_ID)
instead, I can get the job done. I dont know how to hook it properly to get_permalink.
I tried this, but this just makes it enter an infinite loop :
add_filter('post_link','cg_post_permalink');
function cg_post_permalink(){ return get_permalink($post_ID); }
here I read that post_link
was the hook for the get_permalink function
PS - please do not suggest using an iframe since it has its own set of complications. :)