This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

How to disable the mobile theme altogether and use my own?

  • Creator
    Topic
  • #6790
    dwexler
    Member

    I’d like to use my own php based mobile theme instead of the mobile responsive theme that comes with Alyeska. In the theme, at: Theme Options > Configuration > Responsiveness I can choose:

    Yes, apply special styles to tablets and mobile devices.
    or
    No, allow website to show normally on tablets and mobile devices.

    I do not want to enable the built in special styles, I want to disable them.
    When I choose No, somehow this blocks my special code (added separately).

    How can I completely disable your mobile site from Alyeska so I can use my own mobile detect and redirect script?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #6792
    dwexler
    Member

    I’m wondering is there is a theme option area that can be edited as in your example for the footer option.
    (Of course, I’ll need the responsive option, instead).

    In the example, the footer option code has changed to add an array:
    echo themeblvd_get_option( 'footer_copyright', '', 'This is our default value');

    I need to add a php snippet to the every page that I want to be mobile re-directed – so, for WP sites, I add this before the DOCTYPE declaration, in this case in header.php

    The snippet I add is simple:
    <?php
    require_once "class.mobile.php";
    $mobile = new MDD_mobiledevicedetect("/m");
    ?>

    Is there a way to add the an option to use my redirect script in lieu of yours?
    Would the best place to do this be in a get_option area (for the responsive option)?
    How would you go about it?

    We really like using your themes for desktop viewing and we prefer our own custom mobile site framework for mobile and tablets.

    Thanks.

    #6793
    dwexler
    Member

    Back again…
    If I were to add an option into the Config section, with a text area for the php snippet,

    How can I get the snippet to:
    a) be inserted at line 1 of header.php
    b) disable all references to the existing responsive redirect and its’ styling?

    #6802
    Jason Bobich
    Keymaster

    Hello,

    It sounds like you’re sort of misunderstanding the approach taken here to responsive design. So, let me try to clear some things up. This theme does not forward to any kind of separate mobile template. The theme is simply responsive — This means that it scales down with the viewport of the browser window. Any modifications needed as the site scales down are done with @media queries within the CSS.

    All of this CSS is located within a separate file called responsive.css in order to make it easier to provide the option you’re referencing easier.

    If you’re going to just be forwarding to completely separate template files, realistically what you select under Theme Options > Configuration > Responsiveness isn’t going to make any difference.

    a) be inserted at line 1 of header.php

    This technically is only possible if you were to directly insert into header.php. You’d do this by copying the file to your Child theme and then making your edits. — I would suggest not doing this, though.

    I would think it would make more sense to just hook your snippet into the correct place in the WordPress loading process from your Child theme’s functions.php.

    http://codex.wordpress.org/Plugin_API/Action_Reference

    You would probably want to use the action template_redirect for this. Basically you’d be including your file and exiting before WordPress includes whatever template file it’s supposed to show.

    http://www.mihaivalentin.com/wordpress-tutorial-load-the-template-you-want-with-template_redirect/

    It’s difficult giving an example not know what your instantiated MDD_mobiledevicedetect object does exactly, but it might look something like this.

    function my_mobile_redirect(){
    	require_once get_stylesheet_directory() . "/class.mobile.php"; // Class is in your Child theme's directory
    	$mobile = new MDD_mobiledevicedetect("/m");
    	exit; // Stop WP from loading standard template file
    }
    add_action('template_redirect', 'my_mobile_redirect');
    #6885
    dwexler
    Member

    Hi Jason,
    First, please accept my sincere thanks for making sense of my request and for pointing me in a direction.

    Second, I used a slightly different approach and I believe, found a solution.

    The code I am using is as follows:

    function mobiledetect() {
    require_once "/home/user/public_html/domain_directory/class.mobile.php";
    $mobile = new MDD_mobiledevicedetect("http://www.domain.com/m");
    }
    add_action('send_headers','mobiledetect');

    In my case, the external mobile index page has a link to the “Regular Site” and uses a forced load to override the mobile detection. In my testing, when I set the Responsive option to Yes, then my forced load would show the Alyeska responsive theme. As expected.

    Turning the Responsive Option to No, the forced load returns the larger WP theme (no responsive css).

    re: Child Theme
    I have Alyeska installed. No Child theme.
    I added the code above into functions.php, below the opening php tag

    http://mountainviewac.com will redirect to http://mountainviewac.com/m based on browser

    (NOTE: This is a client site – please, for those who come after… respect the client)

    Thank you very much for your support! In a day and age where the number 1 reason that customers find other vendors is un-met expectations, your attention to this little detail means a ton to me.

    … and if you have any ideas about better code, feel free to PM me or post it here.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The forum ‘Alyeska Responsive WordPress Theme’ is closed to new topics and replies.