[wp-hackers] Fooling Wordpress To Think Plugin Output Is A Page

Mike Schinkel mikeschinkel at newclarity.net
Sun Jan 24 01:17:40 UTC 2010


I think what you need is to use page_template instead of using template_redirect, something like this (I've not tested the specific code so it might not be 100% correct):

add_filter('page_template', 'my_page_template' );
function my_page_template($template) {
  global $wp_query;
  if ($is_my_custom_page)
    $template = TEMPLATEPATH + '/my_page_template.php'
  return $template;
}

HTH.

-Mike Schinkel
	



On Jan 23, 2010, at 7:42 PM, Alex Andrews wrote:

> Dear list,
> 
> In my plugin I interrupt template_redirect to produce my own pages via
> loading my own templates. However, to trick certain bits of the
> template into working, it would be very useful for Wordpress to think
> these are pages proper, with titles etc. Is there some internal
> Wordpress variable or set of variables I can set to do this? It would
> be especially good if I could trick the plugin generated page to think
> it was a part of the normal hierarchy of Wordpress pages, ie could
> possibly have parents etc, while not being an part of this formally.
> 
> Thanks you for help
> 
> Alex
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list