[wp-hackers] Load page instead of including it
Dion Hulse (dd32)
wordpress at dd32.id.au
Fri Sep 2 10:18:55 UTC 2011
You're best NOT loading the theme file (or a plugin file for that matter)
directly.
The "standard" way is to just use a Page Template and assign that to a page,
The next option is to use a custom query var, and/or a a WordPress rewrite
rule, ie. catch $_GET['my-query=var'] on template_redirect, and load your
page directly (ie. don't run get_header()/get_footer() in the template file
you include).
There's a few other options depending on what you're actually doing.. For
example, Custom RSS feeds can be defined, as well as using admin-ajax.php
(it has logged in, and not-logged in actions).
Maybe you could give some details and someone can suggest the best method?
On 2 September 2011 20:13, NewKind <newkind at gmail.com> wrote:
> Hi,
>
> I was wondering if theres something like load_template that would replace
> the whole content instead of just including the provided file.
>
> I'm trying to redirect user (on a certain conditions) to a custom php file
> located in the theme directory. The issue is that to do that the WP way,
> i need to use require_once and point it from the theme directory to the wp
> directory. The require_once('../../../wp-blog-header.php'); doesn't work,
> and since WP isn't initialized - I don't have access to such constants like
> ABSPATH.
>
> Maybe one of you knows a better way to do this …
>
> Thanks!
> _______________________________________________
> 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