PluginProbe
Multi Device Switcher / 1.5.2
Multi Device Switcher v1.5.2
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.5.2, at readme.md

480 lines 15.2 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 - Switch the content of the post or page for each device by the **Display Switcher** Shortcode.
12 - Disable the switching of the theme by a particular URL by the **Disable Switcher**.
13 - Can be using is_multi_device() function that detect of the device.
14 - **Multi Device Switcher Command** command-line tool (required WP-CLI)
15
16 ## How do I use it ?
17
18 1. Download and unzip files. Or install multi-device-switcher using the WordPress plugin installer. In that case, skip 2.
19 2. Upload "multi-device-switcher" to the "/wp-content/plugins/" directory.
20 3. Activate the plugin through the 'Plugins' menu in WordPress.
21 4. Upload a separate theme to the "/wp-content/themes/" directory.
22 5. Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
23 6. Configure settings to your needs. Select Theme by Theme option. Add and fix UserAgent by UserAgent option if necessary.
24 7. Have fun!
25
26 ## Screenshot
27
28 <img src="screenshot-1.png">
29 <img src="screenshot-2.png">
30 <img src="screenshot-3.png">
31 <img src="screenshot-4.png">
32 <img src="screenshot-5.png">
33
34 ## How to add the Custom Switcher
35
36 1. Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
37 2. Enter the name of the Custom Switcher (20 characters max, alphanumeric) to the 'Add Custom Switcher'. Push the button 'Add'.
38 3. Configure settings. Select Theme by Theme option. Add UserAgent by UserAgent option.
39 4. Have fun!
40
41 ## Setting and Using the PC Switcher
42
43 There are three ways how to Using the PC Switcher.
44
45 <img src="screenshot-4.png">
46
47 ### 1. Add a PC Switcher to the footer
48
49 1. Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
50 2. Configure settings. Check the checkbox 'Add a PC Switcher to the footer.' by PC Switcher option.
51 3. Have fun!
52
53 ### 2. Add a PC Switcher to your sidebars/widget areas
54
55 1. Add-on the widget 'PC Switcher', when you activate the plugin "Multi Device Switcher".
56 2. Go to the "Widgets" options page through the 'Appearance' menu in WordPress.
57 3. Drag and drop the title bars 'PC Switcher' into the desired area.
58 4. Have fun!
59
60 ### 3. For the theme authors and developers, add a PC Switcher to your theme.
61
62 1. Add the following code into the PHP files, when you develop your theme.
63 ```
64 <?php if ( function_exists('multi_device_switcher_add_pc_switcher') ) { multi_device_switcher_add_pc_switcher(); } ?>
65 ```
66 2. Have fun!
67
68 ### Using default CSS and customized CSS
69
70 1. Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
71 2. Configure settings. Check the checkbox 'Add a default CSS.' by PC Switcher option. If you want to customize CSS, uncheck the checkbox.
72 3. Have fun!
73
74 You can design the PC Switcher in the Style Sheet.
75
76 #### HTML output of the PC Switcher
77
78 ```
79 <div class="pc-switcher"><span class="active">Mobile</span><a href="http://DOMEIN/PATH/TO/?pc-switcher=1">PC</a></div>
80 ```
81
82 #### HTML output of the PC Switcher when switched
83
84 ```
85 <div class="pc-switcher"><a href="http://DOMEIN/PATH/TO/?pc-switcher=0">Mobile</a><span class="active">PC</span></div>
86 ```
87
88 ## How to use the Display Switcher Shortcode
89
90 The **Display Switcher** Shortcode switch the content of the post or page through the detection of the device.
91
92 Add the shortcode `[multi]` in a post or page and use the `device` attribute to device name. if the device attribute is empty, detect the desktop PC.
93
94 ### Attributes
95
96 **device**
97
98 (string | empty) The name of the device
99
100 * smart
101 * tablet
102 * mobile
103 * game
104 * the name of the Custom Switcher
105
106 if empty, detect the desktop PC
107
108 ### Example Shortcode
109
110 ```
111 [multi]pc or other specific stuff here[/multi]
112 [multi device="smart"]smartphone specific stuff here[/multi]
113 [multi device="tablet"]tablet specific stuff here[/multi]
114 [multi device="test"]test Custom Switcher specific stuff here[/multi]
115 ```
116
117 For theme or plugin developers. Filters The Display Switcher Shortcode through hooks. In that case, edit theme or plugin files.
118
119 ```
120 <?php
121 echo do_shortcode('[multi device="smart"]smartphone specific stuff here[/multi]');
122 ?>
123 ```
124
125 ## How to use the Disable Switcher
126
127 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.
128
129 1. Go to the "Multi Device Switcher" options page through the 'Appearance' menu in WordPress.
130 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.
131 3. Have fun!
132
133 ### Example
134
135 ```
136 /sample-page
137 /2015/01/hello-world
138 ```
139
140 ##### Regex mode (in the case of regular expression)
141
142 ```
143 \/sample\-
144 \/2015\/01
145 ```
146
147 ## UserAgent option Samples
148
149 * [](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)
150
151
152 ## Detect the device by JavaScript
153
154 Multi Device Switcher set the Cookie that holds the state of the switch. You can get the Cookie and detect the device by JavaScript.
155
156 ### Cookies
157
158 * `multi-device-switcher` The name of the device is switched (value: null | device name)
159 * `disable-switcher` State of disabled (value: null | 1)
160 * `pc-switcher` State of the PC Switcher when switched (value: null | 1)
161
162 ### Example
163
164 ```
165 <script src="http://DOMEIN/PATH/TO/jquery.cookie.js"></script>
166 <script>
167 (function($) {
168 $(function() {
169 if ( $.cookie( 'multi-device-switcher' ) == 'smart' ) {
170 /* smartphone specific stuff here */
171 } else if ( $.cookie( 'multi-device-switcher' ) == 'tablet' ) {
172 /* tablet specific stuff here */
173 } else {
174 /* pc or other specific stuff here */
175 }
176 });
177 })(jQuery);
178 </script>
179 ```
180
181 ## is_multi_device() function
182
183 **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.
184
185 ### Usage
186
187 ```
188 <?php is_multi_device('smart'); ?>
189 ```
190
191 ### Example
192
193 ```
194 <?php
195 if ( function_exists( 'is_multi_device' ) ) {
196 if ( is_multi_device('smart') ) {
197 /* Display and echo smartphone specific stuff here */
198 } elseif ( is_multi_device('tablet') ) {
199 /* Display and echo tablet specific stuff here */
200 } else {
201 /* Display and echo pc or other specific stuff here */
202 }
203 }
204 ?>
205 ```
206
207 ### Parameters
208
209 **device name** (required)
210
211 (string) The name of the device
212
213 * smart
214 * tablet
215 * mobile
216 * game
217 * the name of the Custom Switcher
218
219 ### Return Values
220
221 (boolean) Return boolean whether a particular device.
222
223 ## is_pc_switcher() function
224
225 **is_pc_switcher()** function is a boolean function, meaning it returns either TRUE or FALSE. Return the the state of PC Switcher by the Multi_Device_Switcher class. Return true if the theme has switched by the PC Switcher.
226
227 ### Usage
228
229 ```
230 <?php is_pc_switcher(); ?>
231 ```
232
233 ### Example
234
235 ```
236 <?php
237 if ( function_exists( 'is_pc_switcher' ) ) {
238 if ( is_pc_switcher() ) {
239 /* Theme switched by the PC Switcher. Display and echo specific stuff here */
240 } else {
241 /* Display and echo specific stuff here */
242 }
243 }
244 ?>
245 ```
246
247 ### Parameters
248
249 None
250
251 ### Return Values
252
253 (boolean) Return the state of PC Switcher.
254
255
256 ## is_disable_switcher() function
257
258 **is_disable_switcher()** function is a boolean function, meaning it returns either TRUE or FALSE. Return the state of disabled by the Multi_Device_Switcher class.
259
260 ### Usage
261
262 ```
263 <?php is_disable_switcher(); ?>
264 ```
265
266 ### Example
267
268 ```
269 <?php
270 if ( function_exists( 'is_disable_switcher' ) ) {
271 if ( is_disable_switcher() ) {
272 /* Disabled. Display and echo specific stuff here */
273 } else {
274 /* Display and echo specific stuff here */
275 }
276 }
277 ?>
278 ```
279
280 ### Parameters
281
282 None
283
284 ### Return Values
285
286 (boolean) Return the state of disabled.
287
288 ## Multi Device Switcher Command
289
290 The **Multi Device Switcher Command** is command-line tool.
291
292 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.
293
294 ### NAME
295
296 wp multi-device
297
298 ### DESCRIPTION
299
300 Multi Device Switcher Command
301
302 ### SYNOPSIS
303
304 wp multi-device <command>
305
306 ### SUBCOMMANDS
307
308 add add Custom Switcher
309 css turn on/off default CSS
310 delete delete Custom Switcher
311 pc-switcher turn on/off PC Switcher
312 reset reset Settings to Default UserAgent
313 status get status of settings
314 theme get or switch a theme
315 useragent get or set UserAgent
316
317
318 For more information about the Multi Device Switcher Command, see `wp help multi-device <SUBCOMMANDS>`.
319
320
321 ### Command examples
322
323 get status of settings
324
325 wp multi-device status
326
327 Active Theme: Twenty Fifteen | twentyfifteen
328 +--------------------------+-----------------+----------------+-------------------------------------------------------------------------+
329 | Device | Theme | Slug | UserAgent |
330 +--------------------------+-----------------+----------------+-------------------------------------------------------------------------+
331 | smartphone (Smart Phone) | Twenty Fourteen | twentyfourteen | iPhone, iPod, Android, dream, CUPCAKE, Windows Phone, webOS, BB10, Blac |
332 | | | | kBerry8707, BlackBerry9000, BlackBerry9300, BlackBerry9500, BlackBerry9 |
333 | | | | 530, BlackBerry9520, BlackBerry9550, BlackBerry9700, BlackBerry 93, Bla |
334 | | | | ckBerry 97, BlackBerry 99, BlackBerry 98 |
335 | tablet (Tablet PC) | Twenty Thirteen | twentythirteen | iPad, Kindle, Sony Tablet, Nexus 7 |
336 | mobile (Mobile Phone) | Twenty Twelve | twentytwelve | DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile |
337 | | | | , DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Noki |
338 | | | | a |
339 | game (Game Platforms) | Twenty Eleven | twentyeleven | PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlaySt |
340 | | | | ation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox |
341 +--------------------------+-----------------+----------------+-------------------------------------------------------------------------+
342 PC Switcher: on
343 default CSS: on
344
345 switch twentyfifteen in theme of smartphone using theme slug
346
347 wp multi-device theme smartphone twentyfifteen
348
349 set UserAgent in theme of tablet
350
351 wp multi-device useragent tablet 'iPad, Kindle, Sony Tablet, Nexus 7'
352
353 add example Custom Switcher
354
355 wp multi-device add example
356
357 add example Custom Switcher. set twentyfifteen theme and UserAgent using theme slug
358
359 wp multi-device add example twentyfifteen 'iPad, Kindle, Sony Tablet, Nexus 7'
360
361 delete example Custom Switcher
362
363 wp multi-device delete example
364
365 turn on default CSS
366
367 wp multi-device css on
368
369 ## Contributing
370
371 ### Patches and Bug Fixes
372
373 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.
374
375 #### Contributors
376
377 * hykw [](https://github.com/hykw/multi-device-switcherGithub](https://github.com/hykw/multi-device-switcher](https://github.com/hykw/multi-device-switcher)
378
379 ### Translations
380
381 Translating a plugin takes a lot of time, effort, and patience. I really appreciate the hard work from these contributors.
382
383 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.
384
385 #### Translator
386
387 - Japanese (ja) - <a href="http://global.thingslabo.com/blog/">Thingsym</a>
388
389 ##### The latest PO and MO files
390
391 - [](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)
392 - [](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/)
393
394 ##### Send your own language pack
395
396 You can send your own language pack to author.
397
398 - [](https://github.com/thingsym/multi-device-switchermulti-device-switcher - GitHub](https://github.com/thingsym/multi-device-switcher](https://github.com/thingsym/multi-device-switcher)
399 - [](http://global.thingslabo.com/blog/http://global.thingslabo.com/blog/ (en)](http://global.thingslabo.com/blog/](http://global.thingslabo.com/blog/)
400 - [](http://blog.thingslabo.comhttp://blog.thingslabo.com (ja)](http://blog.thingslabo.com](http://blog.thingslabo.com)
401
402 ## Changelog
403
404 * Version 1.5.2
405 * fixed: fix setcookie()
406 * Version 1.5.1
407 * fixed: fix preg_split()
408 * Version 1.5.0
409 * fixed: refactoring by the PHP_CodeSniffer
410 * fixed: change admin functions to class/object methods
411 * Version 1.4.2
412 * edited: edit readme
413 * new features: Display Switcher Shortcode
414 * updated: update default UserAgent
415 * fixed: fix pc-switcher ssl url
416 * Version 1.4.1
417 * edited: edit readme
418 * new features: is_disable_switcher() function
419 * new features: is_pc_switcher() function
420 * fixed: fix redirect url and pc-switcher url
421 * Version 1.4.0
422 * edited: edit readme
423 * added: add cookies 'multi-device-switcher', 'disable-switcher'
424 * new features: Disable Switcher
425 * fixed: fix get_options_userAgent(), multi_device_switcher_get_options()
426 * fixed: add reserved words validate
427 * new features: Multi Device Switcher Command
428 * added: add option settings into Theme Customizer
429 * fixed: refactoring by the PHP_CodeSniffer
430 * Version 1.3.0
431 * fixed: fix script, style, html and readme
432 * new features: is_multi_device() function
433 * fixed: fix translation
434 * updated: update default UserAgent
435 * fixed: replace WP_PLUGIN_URL with plugins_url()
436 * fixed: using Page Hook Suffix
437 * merged: pull request [#3](https://github.com/thingsym/multi-device-switcher/pull/3)
438 * Version 1.2.3
439 * fixed: fix redirect uri with query string, using add_query_arg
440 * fixed: fix translation
441 * fixed: fix readme
442 * Version 1.2.2
443 * improved: improve responsiveness UI
444 * fixed: fix html
445 * Version 1.2.1
446 * fixed: delete add_contextual_help
447 * fixed: fix readme and html
448 * Version 1.2.0
449 * added: add PC Switcher Widget
450 * new features: PC Switcher
451 * added: add the settings link to the plugin page
452 * Version 1.1.2
453 * required: at least version 3.4
454 * fixed: fix tabs and buttons
455 * Version 1.1.1
456 * fixed: change the order of the UserAgent detection
457 * updated: update default UserAgent
458 * added: add HTTP/1.1 Vary header
459 * Version 1.1.0
460 * new features: Custom Switcher
461 * Version 1.0.4
462 * fixed: fix the object model PHP5, __construct() to replace Multi_Device_Switcher
463 * fixed: wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme()
464 * Version 1.0.3
465 * updated: update screenshots
466 * fixed: fix reset button
467 * Version 1.0.2
468 * added: add file uninstall.php
469 * fixed: split admin_enqueue_scripts() into two functions
470 * fixed: detects is_admin()
471 * Version 1.0.1
472 * fixed: split multi_device_switcher_init() into two functions
473 * Version 1.0.0
474 * Initial release.
475
476 ## Upgrade Notice
477
478 * 1.1.2
479 * Requires at least version 3.4 of the Wordpress
480