WordPress.org

Ready to get started?Download WordPress

Forums

Redirecting mobile users to another theme (3 posts)

  1. Ameisenman
    Member
    Posted 3 years ago #

    Hi everyone,
    I want to make my theme redirecting mobile visitors to another theme. I found a lot of tutorials either using a bunch of plugins (which I don't want to) or telling me, that you cannot redirect outside of a plugin. I found this way to change the stylesheet and template directory but not to change the folder of the themes:

    add_filter('template', array(&$this, 'switch_theme'));
    add_filter('option_template', array(&$this, 'switch_theme'));
    add_filter('option_stylesheet', array(&$this, 'switch_theme'));
    
    function switch_theme()
    {
    global $device;
    return $device;
    }

    Using this in my themes functions.php it changes the stylesheet directories but not the directory for the files like head.php or index.php to the other folder. Where am I wrong? Any help would be appreciated!!!

    Thanx in advance
    Dietmar

  2. Anders
    Member
    Posted 2 years ago #

    So you're trying to use a completely different theme?

  3. Ameisenman
    Member
    Posted 2 years ago #

    No, I try to redirect mobile users to a child theme of my theme framework...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.