{"id":24973,"date":"2013-08-27T11:03:38","date_gmt":"2013-08-27T11:03:38","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/ttt-devices\/"},"modified":"2015-09-14T10:04:32","modified_gmt":"2015-09-14T10:04:32","slug":"ttt-devices","status":"closed","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/ttt-devices\/","author":11983211,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"0.4","stable_tag":"0.4","tested":"3.7.41","requires":"3.4","requires_php":"","requires_plugins":"","header_name":"TTT Devices","header_author":"33 Themes UG i.Gr.","header_description":"","assets_banners_color":"ccc18e","last_updated":"2015-09-14 10:04:32","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/www.33themes.com","header_author_uri":"http:\/\/www.33themes.com","rating":5,"author_block_rating":0,"active_installs":100,"downloads":2402,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"1"},"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":"1240884","resolution":"128x128","location":"assets"},"icon-256x256.png":{"filename":"icon-256x256.png","revision":"1240884","resolution":"256x256","location":"assets"}},"assets_banners":{"banner-1544x500.png":{"filename":"banner-1544x500.png","revision":"1240884","resolution":"1544x500","location":"assets"},"banner-772x250.png":{"filename":"banner-772x250.png","revision":"1240884","resolution":"772x250","location":"assets"}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.3","0.4"],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[20098,9111,11414,841,12165],"plugin_category":[],"plugin_contributors":[85156,85152,85153,85154,85155],"plugin_business_model":[],"class_list":["post-24973","plugin","type-plugin","status-closed","hentry","plugin_tags-body-class","plugin_tags-devices","plugin_tags-media-queries","plugin_tags-mobile","plugin_tags-user-agents","plugin_contributors-11bits","plugin_contributors-33themes","plugin_contributors-gabrielperezs","plugin_contributors-lonchbox","plugin_contributors-tomasog","plugin_committers-33themes","plugin_committers-gabrielperezs","plugin_committers-lonchbox"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/ttt-devices_ccc18e.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>This plugin detects the client device in a simple way at php level.<\/p>\n\n<h3>Identify the device with a CSS body class<\/h3>\n\n<ul>\n<li><p>For a desktop in linux<\/p>\n\n<p>\n\n\n<\/p><\/li>\n<li><p>For a desktop in Mac<\/p>\n\n<p>\n\n\n<\/p><\/li>\n<li><p>For an iphone mobile<\/p>\n\n<p>\n\n\n<\/p><\/li>\n<li><p>For an iphone mobile landscape<\/p>\n\n<p>\n\n\n<\/p><\/li>\n<li><p>For an android mobile<\/p>\n\n<p>\n\n\n<\/p><\/li>\n<\/ul>\n\n<p>And also for IE ;)<\/p>\n\n<h3>How to indentify the device<\/h3>\n\n<pre><code>&lt;?php\nif ( is_tttdevice('desktop') ) {\n    echo \"this is a desktop device\";\n}\nelseif ( is_tttdevice('mobile') ) {\n    echo \"this is a mobile device\";\n}\nelseif ( is_tttdevice('tablet') ) {\n    echo \"this is a tablet device\";\n}\nelse {\n    echo \"Opps...  we don't know what this device is!!\";\n}\n?&gt;\n<\/code><\/pre>\n\n<h3>How to remove the sidebar for mobile only<\/h3>\n\n<pre><code>&lt;?php\nif ( ! is_tttdevice('mobile') ) {\n    get_sidebar();\n}\n?&gt;\n<\/code><\/pre>\n\n<p>This means, the sidebar will not show in mobile devices. This is not the same has \"hidden\" in CSS, with TTT Devices the code is not  sent to the client.<\/p>\n\n<h3>Other keywords to detect devices<\/h3>\n\n<pre><code>&lt;?php\nif ( is_tttdevice('iphone') ) {\n    echo \"this is an iPhone\";\n}\nif ( is_tttdevice('android') ) {\n    echo \"this is an android\";\n}\nif ( is_tttdevice('windowsphone') ) {\n    echo \"this is an windows phone\";\n}\nif ( is_tttdevice('mobile') ) {\n    echo \"this is a mobile\";\n}\n?&gt;\n<\/code><\/pre>\n\n<h3>Stop loading some js for mobile<\/h3>\n\n<p>It is very useful if you need make your site faster for mobile or tablet, these browsers can't handle well some javascript effects. You can stop loading them in mobile devices. Example:<\/p>\n\n<p>In your functions.php file:<\/p>\n\n<pre><code>function heavyanimation_script() {\n    if ( is_tttdevice('desktop') ) { \n        wp_enqueue_script( 'heavyanimation', get_template_directory_uri() . '\/js\/havyscript.js', array('jquery'));\n    }\n}   \nadd_action('wp_enqueue_scripts', 'heavyanimation_script');\n<\/code><\/pre>\n\n<p>This means that js only loads in desktop devices, easy :)<\/p>\n\n<!--section=installation-->\n<p>This section describes how to install the plugin and get it working.<\/p>\n\n<ol>\n<li>Upload <code>ttt-devices<\/code> folder to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt>How does the plugin detecte devices?<\/dt>\n<dd><p>We use the user agent of the browser client.<\/p><\/dd>\n<dt>Does the plugin use some standar library?<\/dt>\n<dd><p>Yes, we use the sources from http:\/\/www.mobileesp.com<\/p>\n\n<p>For better performance with server cache systems like varnish the plugin detects the browser using Javascript. The idea came from this threat: http:\/\/stackoverflow.com\/a\/2401861<\/p><\/dd>\n\n<\/dl>","raw_excerpt":"Improve your adaptive web design with detecting the devices that visit your website.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/24973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=24973"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/33themes"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=24973"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=24973"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=24973"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=24973"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=24973"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=24973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}