Categories

  • Access & Security 95
  • Administration 172
  • Advertisement 92
  • Audio & Video 66
  • Author & Content 99
  • Comments 96
  • Communication 110
  • Communities & Forums 84
  • Development 47
  • E-Commerce 76
  • Email Management 53
  • Events & Calendars 80
  • Language 25
  • Map & Weather 44
  • Migration & Conversion 28
  • Miscellaneous 254
  • Mobile 15
  • Photos 143
  • Plugins 260
  • SEO & Site Speed 118
  • Social 186
  • Theme Enhancement 169



  • Add this plugin to a List

    You need to be logged in to add this plugin to your list.

    Nginx Mobile Theme

    Add to List

    This plugin allows you to switch theme according to the User Agent on the Nginx reverse proxy.

    Nginx Mobile Theme’s requirements are as follows.

    Some Features

    • You can flush mobile’s and pc’s each caches automatically via Nginx Cache Controller.
    • Allow you to switch theme according to the user-agent.
    • Allow you to customize multiple mobile device support via filter-hook.

    Nginx Configuration

    Add mobile device detection to the nginx.conf.

    set $mobile '';
    if ($http_user_agent ~* '(iPhone|iPod|incognito|webmate|Android|dream|CUPCAKE|froyo|BlackBerry|webOS|s8000|bada|IEMobile|Googlebot-Mobile|AdsBot-Google)') {
        set $mobile "@smartphone";
    }
    

    Set proxy_cache_key.

    proxy_cache_key "$mobile$scheme://$host$request_uri";
    

    Send custom request header to the backend.

    proxy_set_header X-UA-Detect $mobile;
    

    Nginx Mobile Theme will switch theme when ‘@smartphone’ is received in the $_SERVER['HTTP_X_UA_DETECT'].

    How to use

    1. Please access to the theme-customizer in the WordPress admin area.
    2. Please select Mobile Theme in the drop-down.
    3. Click “Save & Publish” button to save.

    Multiple mobile device support

    1. Add custom mobile detection to the nginx.conf.
    2. Add custom mobile detection to the WordPress via nginxmobile_mobile_detects filter-hook.

    nginx.conf:
    set $mobile ”;
    if ($http_user_agent ~* ‘(iPhone|iPod)’) {
    set $mobile “@smartphone”;
    }
    if ($http_user_agent ~* ‘iPad’) {
    set $mobile “@tablet”;
    }

    In your custom plugin:
    add_filter(‘nginxmobile_mobile_detects’, function(){
    return array(‘@smartphone’, ‘@tablet’);
    });

    • As a result, allow you to select theme for @smartphone and @tablet individually in the theme-customizer.

    Amimoto Support

    The Amimoto is a full-tuned WordPress AMI on the AWS EC2.

    • Uncomment /etc/nginx/conf.d/default.conf in line 17

    before:
    #include /etc/nginx/mobile-detect;

    after:
    include /etc/nginx/mobile-detect;

    • Add line to /etc/nginx/nginx.conf like following.

    before:
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Accept-Encoding “”;

    after:
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Accept-Encoding “”;
    proxy_set_header X-UA-Detect $mobile; # add new line

    • Define constant in the wp-config.php

      define(‘IS_AMIMOTO’, true);

    Rate This Plugin

    Please Login to Rate this Plugin!

    Function

    Feature

    Support

    0 Votes
    Not Rated Yet

    Wordpress.org Stats

    Ratings5
    Votes2
    Downloads51,670
    Last Updated763 Days ago
    Published4 years ago

    Report Wrong Category!