[wp-hackers] Load page instead of including it

NewKind newkind at gmail.com
Sat Sep 3 07:57:54 UTC 2011


Hey,

Thanks for all answers, I'll play a little bit more with it ;) And there's definitely going
to be an option to disable that in case someone doesn't want to use it.

Thanks!

On 2 wrz 2011, at 13:39, Dion Hulse (dd32) wrote:

> Ah, literally, an "unsupported browser page". In those situations, if you're
> intending on distributing the theme to others, I highly suggest you use a
> page. Detect an unsupported browser (if you must, and can't possibly
> gracefully degrade), and redirect to a user-defined page. This way the user
> has the ability to customise what their website looks like, and you can
> offer a page template as well for a predefined text/look.
> 
> Generally in a theme which is distributed, I'd advise against doing
> something "smart" like that, simply for the reason that it creates a lock in
> effect of using your theme rather than switching to another theme down the
> line.. and definitely not by default in most cases as automated detection
> can often fail or be confused, and/or lock users out unintentionally..
> 
> On 2 September 2011 21:18, Mika A Epstein <ipstenu at ipstenu.org> wrote:
> 
>> You can put a browser detect line in the 404 page code, via PHP.  If it's
>> just a non-supported browser hitting a non-existent page, there's no need to
>> reinvent the wheel.
>> 
>> If it's something else, of course, details matter.
>> 
>> 
>> On Sep 2, 2011, at 6:04 AM, NewKind <newkind at gmail.com> wrote:
>> 
>>> Yes, it's like a 404 page, but it would be displayed only when user will
>> try to load the page with unsupported browser.
>>> Thanks, for the hint - i'll take a look at the rewrite rules.
>>> 
>>> Thanks!
>>> 
>>> On 2 wrz 2011, at 12:33, Dion Hulse (dd32) wrote:
>>> 
>>>> Unfortunately that doesn't help me understand it at all.. "unsupported
>> page"
>>>> sounds like a 404 to me?
>>>> Failing that, my 2nd suggestion seems to be what you want:
>>>> 
>>>>> 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).
>>>> 
>>>> On 2 September 2011 20:29, NewKind <newkind at gmail.com> wrote:
>>>> 
>>>>> Well it's just a landing page that would be displayed when user is
>> using an
>>>>> unsupported page.
>>>>> There are no loops or any particular content besides the hardcoded one,
>> but
>>>>> what I'd like to have
>>>>> on that page is the support for plugins to load theirs stuff, and wp
>> header
>>>>> with wp footer.
>>>>> 
>>>>> So it's a page with hardcoded html code + content, but dynamically
>>>>> generated headers.
>>>>> 
>>>>> The way from integrating external pages with wp would be ideal but just
>>>>> like I said, there are issues
>>>>> with including the wp-blog-header.php file on different environments. I
>>>>> don't want to use pages + page
>>>>> templates as this strictly depends on users content.
>>>>> 
>>>>> Thanks
>>>>> 
>>>>> On 2 wrz 2011, at 12:18, Dion Hulse (dd32) wrote:
>>>>> 
>>>>>> 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
>>>>>>> 
>>>>>> _______________________________________________
>>>>>> wp-hackers mailing list
>>>>>> wp-hackers at lists.automattic.com
>>>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>> 
>>>>> _______________________________________________
>>>>> wp-hackers mailing list
>>>>> wp-hackers at lists.automattic.com
>>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>> 
>>>> _______________________________________________
>>>> wp-hackers mailing list
>>>> wp-hackers at lists.automattic.com
>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>> 
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>> 
> _______________________________________________
> 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