{"id":1303,"date":"2014-03-29T14:35:03","date_gmt":"2014-03-29T05:35:03","guid":{"rendered":"http:\/\/www.santoshkori.com\/blog\/?p=1303"},"modified":"2014-03-29T14:35:03","modified_gmt":"2014-03-29T05:35:03","slug":"server-side-responsive-with-cookies","status":"publish","type":"post","link":"https:\/\/www.santoshkori.com\/blog\/server-side-responsive-with-cookies\/","title":{"rendered":"Server side responsive with cookies"},"content":{"rendered":"<p>here is code which i done after searching over google with help of different website.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\n\t\tfunction setCookie(cname,cvalue,exdays)\t{\r\n\t\t\tvar d = new Date();\r\n\t\t\td.setTime(d.getTime()+(exdays*24*60*60*1000));\r\n\t\t\tvar expires = &quot;expires=&quot;+d.toGMTString();\r\n\t\t\tdocument.cookie = cname+&quot;=&quot;+cvalue+&quot;; &quot;+expires;\r\n\t\t}\r\n\t\twindowwidth = document.body.clientWidth;\r\n\t\tsetCookie(&quot;wwidth&quot;,windowwidth,30);\r\n\t\tvar user1=getCookie(&quot;wwidth&quot;);\r\n\t\t\/\/alert('user1'+user1);\r\n\t\t&lt;\/script&gt;\r\n\t\t&lt;?php $screenWidth = $_COOKIE&#x5B;'wwidth'] ?&gt;\r\n<\/pre>\n<p>Condition php code<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php if ($screenWidth &lt;= 660) { ?&gt;\r\n\t\t&lt;div class=&quot;class1&quot; id=&quot;content&quot;&gt;\r\n\t&lt;?php } else { ?&gt;\r\n\t\t&lt;div class=&quot;class2&quot; id=&quot;content&quot;&gt;\r\n\t&lt;?php } ?&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>here is code which i done after searching over google with help of different website. &lt;script type=&quot;text\/javascript&quot;&gt; function setCookie(cname,cvalue,exdays) { var d = new Date(); d.setTime(d.getTime()+(exdays*24*60*60*1000)); var expires = &quot;expires=&quot;+d.toGMTString(); document.cookie = cname+&quot;=&quot;+cvalue+&quot;; &quot;+expires; } windowwidth = document.body.clientWidth; setCookie(&quot;wwidth&quot;,windowwidth,30); var user1=getCookie(&quot;wwidth&quot;); \/\/alert(&#8216;user1&#8217;+user1); &lt;\/script&gt; &lt;?php $screenWidth = $_COOKIE&#x5B;&#8217;wwidth&#8217;] ?&gt; Condition php code &lt;?php if ($screenWidth &lt;= [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[662,663],"tags":[665,664],"class_list":["post-1303","post","type-post","status-publish","format-standard","hentry","category-responsive-design-2","category-serverside","tag-server-side-responsive","tag-server-side-responsive-with-cookies"],"_links":{"self":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/1303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/comments?post=1303"}],"version-history":[{"count":1,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/1303\/revisions"}],"predecessor-version":[{"id":1304,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/1303\/revisions\/1304"}],"wp:attachment":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/media?parent=1303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/categories?post=1303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/tags?post=1303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}