PluginProbe
Multi Device Switcher / 1.4.0
Multi Device Switcher v1.4.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 All 34 releases
multi-device-switcher / readme.md

readme.md in Multi Device Switcher 1.4.0, at readme.md

361 lines 12.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 # Introducing Multi Device Switcher
2
3 This WordPress plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom).
4 This plugin detects if your site is being viewed by UserAgent, and switches to selected theme. The Custom Switcher can add every device.
5
6 ## Features
7
8 - Set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game), switches to selected theme.
9 - Add every device by the **Custom Switcher**.
10 - Add links 'Mobile' or 'PC' in the theme by the **PC Switcher**, switch to the default theme.
11 - Disable the switching of the theme by a particular URL by the **Disable Switcher**.
12 - Can be using is_multi_device() function that detect of the device.
13 - **Multi Device Switcher Command** command-line tool (required WP-CLI)
14
15 ## How do I use it ?
16
17 1. Download and unzip files. Or install multi-device-switcher using the WordPress plugin installer. In that case, skip 2.
18 2. Upload "multi-device-switcher" to the "/wp-content/plugins/" directory.
19 3. Activate the plugin through the 'Plugins' menu in WordPress.
20 4. Upload a separate theme to the "/wp-content/themes/" directory.
21 5. Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
22 6. Configure settings to your needs. Select Theme by Theme option. Add and fix UserAgent by UserAgent option if necessary.
23 7. Have fun!
24
25 ## Screenshot
26
27 <img src="screenshot-1.png">
28 <img src="screenshot-2.png">
29 <img src="screenshot-3.png">
30 <img src="screenshot-4.png">
31 <img src="screenshot-5.png">
32
33 ## How to add the Custom Switcher
34
35 1. Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
36 2. Enter the name of the Custom Switcher (20 characters max, alphanumeric) to the 'Add Custom Switcher'. Push the button 'Add'.
37 3. Configure settings. Select Theme by Theme option. Add UserAgent by UserAgent option.
38 4. Have fun!
39
40 ## Setting and Using the PC Switcher
41
42 There are three ways how to Using the PC Switcher.
43
44 <img src="screenshot-4.png">
45
46 ### 1. Add a PC Switcher to the footer
47
48 1. Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
49 2. Configure settings. Check the checkbox 'Add a PC Switcher to the footer.' by PC Switcher option.
50 3. Have fun!
51
52 ### 2. Add a PC Switcher to your sidebars/widget areas
53
54 1. Add-on the widget 'PC Switcher', when you activate the plugin "Multi Device Switcher".
55 2. Go to the "Widgets" options page through the 'Appearance' menu in WordPress.
56 3. Drag and drop the title bars 'PC Switcher' into the desired area.
57 4. Have fun!
58
59 ### 3. For the theme authors and developers, add a PC Switcher to your theme.
60
61 1. Add the following code into the PHP files, when you develop your theme.
62 ```
63 <?php if ( function_exists('multi_device_switcher_add_pc_switcher') ) { multi_device_switcher_add_pc_switcher(); } ?>
64 ```
65 2. Have fun!
66
67 ### Using default CSS and customized CSS
68
69 1. Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
70 2. Configure settings. Check the checkbox 'Add a default CSS.' by PC Switcher option. If you want to customize CSS, uncheck the checkbox.
71 3. Have fun!
72
73 You can design the PC Switcher in the Style Sheet.
74
75 #### HTML output of the PC Switcher
76
77 ```
78 <div class="pc-switcher"><span class="active">Mobile</span><a href="http://DOMEIN/PATH/TO/?pc-switcher=1">PC</a></div>
79 ```
80
81 #### HTML output of the PC Switcher when switched
82
83 ```
84 <div class="pc-switcher"><a href="http://DOMEIN/PATH/TO/?pc-switcher=0">Mobile</a><span class="active">PC</span></div>
85 ```
86
87 ## How to use the Disable Switcher
88
89 The **Disable Switcher** disable the switching of the theme by a particular URL. If you match the access the url and a string or a regular expression (Regex mode), disable the switching of the theme. Regex mode is for advanced users.
90
91 1. Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
92 2. Enter the path to the line by line where you want to disable by Disable Switcher option. Check the checkbox 'Enable Regex', if you want to use a regular expression.
93 3. Have fun!
94
95 ### Examples
96
97 ```
98 /sample-page
99 /2015/01/hello-world
100 ```
101
102 ##### Regex mode (in the case of regular expression)
103
104 ```
105 \/sample\-
106 \/2015\/01
107 ```
108
109 ## UserAgent option Samples
110
111 * [](https://github.com/thingsym/multi-device-switcher/wiki/Default-UserAgentDefault UserAgent](https://github.com/thingsym/multi-device-switcher/wiki/Default-UserAgent](https://github.com/thingsym/multi-device-switcher/wiki/Default-UserAgent)
112
113
114 ## Detect the device by JavaScript
115
116 Multi Device Switcher set the Cookie that holds the state of the switch. You can get the Cookie and detect the device by JavaScript.
117
118 ### Cookie
119
120 * `multi-device-switcher` The name of the device is switched (value: null | device name)
121 * `disable-switcher` State of disabled (value: null | 1)
122 * `pc-switcher` State of the PC Switcher when switched (value: null | 1)
123
124 ### Examples
125
126 ```
127 <script src="http://DOMEIN/PATH/TO/jquery.cookie.js"></script>
128 <script>
129 (function($) {
130 $(function() {
131 if ( $.cookie( 'multi-device-switcher' ) == 'smart' ) {
132 /* smartphone specific stuff here */
133 } else if ( $.cookie( 'multi-device-switcher' ) == 'tablet' ) {
134 /* tablet specific stuff here */
135 } else {
136 /* pc or other stuff here */
137 }
138 });
139 })(jQuery);
140 </script>
141 ```
142
143 ## is_multi_device() function
144
145 **is_multi_device()** function is a boolean function, meaning it returns either TRUE or FALSE. Works through the detection of the device by the Multi_Device_Switcher class.
146
147 ### Usage
148
149 ```
150 <?php is_multi_device('smart'); ?>
151 ```
152
153 ### Examples
154
155 ```
156 <?php
157 if ( function_exists( 'is_multi_device' ) ) {
158 if ( is_multi_device('smart') ) {
159 /* Display and echo smartphone specific stuff here */
160 } elseif ( is_multi_device('tablet') ) {
161 /* Display and echo tablet specific stuff here */
162 } else {
163 /* Display and echo pc or other stuff here */
164 }
165 }
166 ?>
167 ```
168
169 ### Parameters
170
171 **device name** (required)
172
173 (string) The name of the device
174
175 * smart
176 * tablet
177 * mobile
178 * game
179 * the name of the Custom Switcher
180
181 ### Return Values
182
183 (boolean) Return boolean whether a particular device.
184
185 ## Multi Device Switcher Command
186
187 The **Multi Device Switcher Command** is command-line tool.
188
189 Add-on the Multi Device Switcher Command, when you activate the plugin "Multi Device Switcher". To use the Multi Device Switcher Command is WP-CLI required.
190
191 ### NAME
192
193 wp multi-device
194
195 ### DESCRIPTION
196
197 Multi Device Switcher Command
198
199 ### SYNOPSIS
200
201 wp multi-device <command>
202
203 ### SUBCOMMANDS
204
205 add add Custom Switcher
206 css turn on/off default CSS
207 delete delete Custom Switcher
208 pc-switcher turn on/off PC Switcher
209 reset reset Settings to Default UserAgent
210 status get status of settings
211 theme get or switch a theme
212 useragent get or set UserAgent
213
214
215 For more information about the Multi Device Switcher Command, see `wp help multi-device <SUBCOMMANDS>`.
216
217
218 ### Command examples
219
220 get status of settings
221
222 wp multi-device status
223
224 Active Theme: Twenty Fifteen | twentyfifteen
225 +--------------------------+-----------------+----------------+-------------------------------------------------------------------------+
226 | Device | Theme | Slug | UserAgent |
227 +--------------------------+-----------------+----------------+-------------------------------------------------------------------------+
228 | smartphone (Smart Phone) | Twenty Fourteen | twentyfourteen | iPhone, iPod, Android, dream, CUPCAKE, Windows Phone, webOS, BB10, Blac |
229 | | | | kBerry8707, BlackBerry9000, BlackBerry9300, BlackBerry9500, BlackBerry9 |
230 | | | | 530, BlackBerry9520, BlackBerry9550, BlackBerry9700, BlackBerry 93, Bla |
231 | | | | ckBerry 97, BlackBerry 99, BlackBerry 98 |
232 | tablet (Tablet PC) | Twenty Thirteen | twentythirteen | iPad, Kindle, Sony Tablet, Nexus 7 |
233 | mobile (Mobile Phone) | Twenty Twelve | twentytwelve | DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile |
234 | | | | , DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Noki |
235 | | | | a |
236 | game (Game Platforms) | Twenty Eleven | twentyeleven | PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlaySt |
237 | | | | ation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox |
238 +--------------------------+-----------------+----------------+-------------------------------------------------------------------------+
239 PC Switcher: on
240 default CSS: on
241
242 switch twentyfifteen in theme of smartphone using theme slug
243
244 wp multi-device theme smartphone twentyfifteen
245
246 set UserAgent in theme of tablet
247
248 wp multi-device useragent tablet 'iPad, Kindle, Sony Tablet, Nexus 7'
249
250 add example Custom Switcher
251
252 wp multi-device add example
253
254 add example Custom Switcher. set twentyfifteen theme and UserAgent using theme slug
255
256 wp multi-device add example twentyfifteen 'iPad, Kindle, Sony Tablet, Nexus 7'
257
258 delete example Custom Switcher
259
260 wp multi-device delete example
261
262 turn on default CSS
263
264 wp multi-device css on
265
266 ## Contributing
267
268 ### Patches and Bug Fixes
269
270 Small patches and bug reports can be submitted a issue tracker in Github. Forking on Github is another good way. You can send a pull request.
271
272 #### Contributors
273
274 * hykw [](https://github.com/hykw/multi-device-switcherGithub](https://github.com/hykw/multi-device-switcher](https://github.com/hykw/multi-device-switcher)
275
276 ### Translations
277
278 Translating a plugin takes a lot of time, effort, and patience. I really appreciate the hard work from these contributors.
279
280 If you have created or updated your own language pack, you can send [](http://codex.wordpress.org/Translating_WordPressgettext PO and MO files](http://codex.wordpress.org/Translating_WordPress](http://codex.wordpress.org/Translating_WordPress) to author. I can bundle it into Multi Device Switcher.
281
282 #### Translator
283
284 - Japanese (ja) - <a href="http://global.thingslabo.com/blog/">Thingsym</a>
285
286 ##### The latest PO and MO files
287
288 - [](http://plugins.svn.wordpress.org/multi-device-switcher/trunk/languages/multi-device-switcher.potPOT file](http://plugins.svn.wordpress.org/multi-device-switcher/trunk/languages/multi-device-switcher.pot](http://plugins.svn.wordpress.org/multi-device-switcher/trunk/languages/multi-device-switcher.pot)
289 - [](http://plugins.svn.wordpress.org/multi-device-switcher/trunk/languages/PO files](http://plugins.svn.wordpress.org/multi-device-switcher/trunk/languages/](http://plugins.svn.wordpress.org/multi-device-switcher/trunk/languages/)
290
291 ##### Send your own language pack
292
293 You can send your own language pack to author.
294
295 - [](https://github.com/thingsym/multi-device-switchermulti-device-switcher - GitHub](https://github.com/thingsym/multi-device-switcher](https://github.com/thingsym/multi-device-switcher)
296 - [](http://global.thingslabo.com/blog/http://global.thingslabo.com/blog/ (en)](http://global.thingslabo.com/blog/](http://global.thingslabo.com/blog/)
297 - [](http://blog.thingslabo.comhttp://blog.thingslabo.com (ja)](http://blog.thingslabo.com](http://blog.thingslabo.com)
298
299 ## Changelog
300
301 * Version 1.4.0
302 * edited: edit readme
303 * added: add cookies 'multi-device-switcher', 'disable-switcher'
304 * new features: Disable Switcher
305 * fixed: fix get_options_userAgent(), multi_device_switcher_get_options()
306 * fixed: add reserved words validate
307 * new features: Multi Device Switcher Command
308 * added: add option settings into Theme Customizer
309 * fixed: refactoring by the PHP_CodeSniffer
310 * Version 1.3.0
311 * fixed: fix script, style, html and readme
312 * new features: is_multi_device() function
313 * fixed: fix translation
314 * updated: update default UserAgent
315 * fixed: replace WP_PLUGIN_URL with plugins_url()
316 * fixed: using Page Hook Suffix
317 * merged: pull request [#3](https://github.com/thingsym/multi-device-switcher/pull/3)
318 * Version 1.2.3
319 * fixed: fix redirect uri with query string, using add_query_arg
320 * fixed: fix translation
321 * fixed: fix readme
322 * Version 1.2.2
323 * improved: improve responsiveness UI
324 * fixed: fix html
325 * Version 1.2.1
326 * fixed: delete add_contextual_help
327 * fixed: fix readme and html
328 * Version 1.2.0
329 * added: add PC Switcher Widget
330 * new features: PC Switcher
331 * added: add the settings link to the plugin page
332 * Version 1.1.2
333 * required: at least version 3.4
334 * fixed: fix tabs and buttons
335 * Version 1.1.1
336 * fixed: change the order of the UserAgent detection
337 * updated: update default UserAgent
338 * added: add HTTP/1.1 Vary header
339 * Version 1.1.0
340 * new features: Custom Switcher
341 * Version 1.0.4
342 * fixed: fix the object model PHP5, __construct() to replace Multi_Device_Switcher
343 * fixed: wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme()
344 * Version 1.0.3
345 * updated: update screenshots
346 * fixed: fix reset button
347 * Version 1.0.2
348 * added: add file uninstall.php
349 * fixed: split admin_enqueue_scripts() into two functions
350 * fixed: detects is_admin()
351 * Version 1.0.1
352 * fixed: split multi_device_switcher_init() into two functions
353 * Version 1.0.0
354 * Initial release.
355
356 ## Upgrade Notice
357
358 * 1.1.2
359 * Requires at least version 3.4 of the Wordpress
360
361