[wp-hackers] Where to insert mobile redirect code?

Mike Schleif wordpress at helices.org
Tue Mar 27 22:57:54 UTC 2012


Hi!

I created a file: aaa-mobile-redirect.php

I added the exact code snippet (below) with no whitespace before nor after.

I uploaded to here: /wp-content/mu-plugins/aaa-mobile-redirect.php

I removed that exact code from the 1st lines of /index.php

It does NOT work.

What am I missing? Thank you.

If ever I can be of service to you; contact me at once.

I wish for you a truly extraordinary day ...

-- 
Best Regards,

Mike Schleif
612-235-6060
http://mdsresource.net
http://tofree.me/GooglePlus
http://www.linkedin.com/in/schleif
http://facebook.com/MDSResource
http://twitter.com/mikeschleif


On 3/27/2012 5:03 PM, Aaron Jorbin wrote:
> I would look at doing it as a MU plugin -
> http://codex.wordpress.org/Must_Use_Plugins
>
> http://aaron.jorb.in
> twitter: twitter.com/aaronjorbin
>
>
> On Tue, Mar 27, 2012 at 6:01 PM, Mike Schleif<wordpress at helices.org>  wrote:
>
>> Hi!
>>
>> I have this simple PHP code:|
>> |
>>
>> |<?php
>> require_once "/_PATH_/_DOMAIN_/class.**mobile.php";
>> $mobile = new MobileWebarto("http://m._**DOMAIN_");
>> ?>|
>>
>>
>> Obviously, _PATH_ and _DOMAIN_ are placeholders.
>>
>> class.mobile.php identifies whether or not the visitor is a mobile device.
>>
>> On most sites, inserting this code at line #1 of header.php behaves
>> exactly as I want and expect.
>>
>> However, some sites do NOT behave as desired.
>>
>> In reality, I want this code to execute PRIOR to any theme code.
>>
>> Furthermore, I don't want WordPress updates to remove the call to this
>> code.
>>
>> It seems that this code could be inserted into index.php - BUT ...
>>
>> HOW can this be done WITHOUT future WP updates removing my code?
>>
>> Please, advise. Thank you.
>>
>> ______________________________**_________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.**com<wp-hackers at lists.automattic.com>
>> http://lists.automattic.com/**mailman/listinfo/wp-hackers<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