I have tried a few different Mobile Theme Plugins for WordPress. My clients site requires we use a separate theme for Mobile visitors instead of a nice responsive theme.

I am running into the same issue with all the Plugins that I have tried though.

My /blog page always shows the Mobile theme, even if I have a cookie set to view the desktop theme, so viewing in a Desktop browser or mobiles, this 1 particular page always ends up showing the mobile theme which is a huge problem.

So to explain how my /blog page is different from other pages I will explain...

I have custom re-write rules which makes all Page post type pages end with a .htm

My /blog page is also a Page post type, however this /blog page has custom re-writes, which makes it work without the .htm that all the other Page post types have.

So in short all my Post of the Page Post Type end with .htm EXCEPT my blog page which is the only page with the problem of showing the proper theme with the Mobile plugins.

Below is the code used for the /blog page custom re-writes...

function custom_rewrites(){
    add_rewrite_rule('blog', 'index.php?pagename=blog','bottom' );

And below is the code that makes my Page Post Types use the .htm extension...

/* Add .htm extension to Page URL Links */
add_action('init', 'htm_page_permalink', -1);
function htm_page_permalink() {
    global $wp_rewrite;
    if ( !strpos($wp_rewrite->get_page_permastruct(), '.htm')){
        $wp_rewrite->page_structure = $wp_rewrite->page_structure . '.htm';

I am currently using this Mobile Plugin http://wordpress.org/plugins/any-mobile-theme-switcher/

Another unique issue, the /blog page that ALWAYS shows the Mobile theme, well it works as normal and shows the proper theme is you are logged into WordPress, so only users that are logged out have the problem of always seeing the mobile theme on this page.

Also if I type into the URL /blog.htm instead of removing the .htm on the blog page, then it also shows the correct theme.

Main Issue

The WordPress site has 2 themes, a Desktop theme and a Mobile theme, it uses a Plugin to detect mobile and show the correct theme. However my custom re-writes seems to be messing this up because my /blog page ALWAYS shows a Mobile theme, regardless if you are viewing the Mobile or Desktop theme for the site.

I realize this is pretty complex but I am hoping someone might know of a simple fix I might just be overlooking.

Also the Custom re-writes and all custom functionality is in a Plugin so that it should work with either theme.

If anyone has any ideas based on this information, please do share, I am at a loss here and running out of options fast.

After playing with this all day and making changes to try an improve this, right now my /blog/ page shows a list of post when I view the blog page or view an actual Posts under the blog, they all show the same page which is a mobile view and lists recent posts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.