{"id":1963,"date":"2015-06-23T12:48:07","date_gmt":"2015-06-23T12:48:07","guid":{"rendered":"http:\/\/www.websitedesignwebsitedevelopment.com\/?p=1963"},"modified":"2015-06-23T12:48:20","modified_gmt":"2015-06-23T12:48:20","slug":"how-to-check-that-you-are-main-page","status":"publish","type":"post","link":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/","title":{"rendered":"PHP function to check that you are main page?"},"content":{"rendered":"<p><code>define('LIVE', (!in_array($_SERVER['HTTP_HOST'], array('localhost', 'wp-mechanic'))));<\/code><br \/>\n<code>\tif(!function_exists('is_main')){<br \/>\n\t\tfunction is_main(){<br \/>\n\t\t\t$uri = $_SERVER['REQUEST_URI'];<br \/>\n\t\t\t$arr = explode('\/', $uri);<br \/>\n\t\t\t$arr = array_filter($arr, 'strlen');<br \/>\n\t\t\treturn ((!LIVE && (count($arr)==1)) || (LIVE && empty($arr)));\/\/empty($uri)<br \/>\n\t\t}<br \/>\n\t}<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>define(&#8216;LIVE&#8217;, (!in_array($_SERVER[&#8216;HTTP_HOST&#8217;], array(&#8216;localhost&#8217;, &#8216;wp-mechanic&#8217;)))); if(!function_exists(&#8216;is_main&#8217;)){ function is_main(){ $uri = $_SERVER[&#8216;REQUEST_URI&#8217;]; $arr = explode(&#8216;\/&#8217;, $uri); $arr = array_filter($arr, &#8216;strlen&#8217;); return ((!LIVE &#038;&#038; (count($arr)==1)) || (LIVE &#038;&#038; empty($arr)));\/\/empty($uri) } }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[12],"tags":[],"class_list":["post-1963","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PHP function to check that you are main page? - AndroidBubble Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP function to check that you are main page? - AndroidBubble Blog\" \/>\n<meta property=\"og:description\" content=\"define(&#039;LIVE&#039;, (!in_array($_SERVER[&#039;HTTP_HOST&#039;], array(&#039;localhost&#039;, &#039;wp-mechanic&#039;)))); if(!function_exists(&#039;is_main&#039;)){ function is_main(){ $uri = $_SERVER[&#039;REQUEST_URI&#039;]; $arr = explode(&#039;\/&#039;, $uri); $arr = array_filter($arr, &#039;strlen&#039;); return ((!LIVE &amp;&amp; (count($arr)==1)) || (LIVE &amp;&amp; empty($arr)));\/\/empty($uri) } }\" \/>\n<meta property=\"og:url\" content=\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/\" \/>\n<meta property=\"og:site_name\" content=\"AndroidBubble Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pages\/Website-Design-Website-Development\/172363336135453\" \/>\n<meta property=\"article:published_time\" content=\"2015-06-23T12:48:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-06-23T12:48:20+00:00\" \/>\n<meta name=\"author\" content=\"Fahad\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fahad\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/\"},\"author\":{\"name\":\"Fahad\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\"},\"headline\":\"PHP function to check that you are main page?\",\"datePublished\":\"2015-06-23T12:48:07+00:00\",\"dateModified\":\"2015-06-23T12:48:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/\"},\"wordCount\":9,\"articleSection\":[\"Wordpress\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/\",\"url\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/\",\"name\":\"PHP function to check that you are main page? - AndroidBubble Blog\",\"isPartOf\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/#website\"},\"datePublished\":\"2015-06-23T12:48:07+00:00\",\"dateModified\":\"2015-06-23T12:48:20+00:00\",\"author\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\"},\"breadcrumb\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/androidbubble.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Website Development\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PHP Frameworks\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/php-frameworks\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Wordpress\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/php-frameworks\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"PHP function to check that you are main page?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#website\",\"url\":\"https:\/\/androidbubble.com\/blog\/\",\"name\":\"AndroidBubble Blog\",\"description\":\"Articles &amp; Posts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/androidbubble.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\",\"name\":\"Fahad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g\",\"caption\":\"Fahad\"},\"sameAs\":[\"http:\/\/www.androidbubbles.com\/\",\"https:\/\/x.com\/phpFlex\"],\"url\":\"https:\/\/androidbubble.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PHP function to check that you are main page? - AndroidBubble Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/","og_locale":"en_US","og_type":"article","og_title":"PHP function to check that you are main page? - AndroidBubble Blog","og_description":"define('LIVE', (!in_array($_SERVER['HTTP_HOST'], array('localhost', 'wp-mechanic')))); if(!function_exists('is_main')){ function is_main(){ $uri = $_SERVER['REQUEST_URI']; $arr = explode('\/', $uri); $arr = array_filter($arr, 'strlen'); return ((!LIVE && (count($arr)==1)) || (LIVE && empty($arr)));\/\/empty($uri) } }","og_url":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/","og_site_name":"AndroidBubble Blog","article_publisher":"https:\/\/www.facebook.com\/pages\/Website-Design-Website-Development\/172363336135453","article_published_time":"2015-06-23T12:48:07+00:00","article_modified_time":"2015-06-23T12:48:20+00:00","author":"Fahad","twitter_misc":{"Written by":"Fahad"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/#article","isPartOf":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/"},"author":{"name":"Fahad","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7"},"headline":"PHP function to check that you are main page?","datePublished":"2015-06-23T12:48:07+00:00","dateModified":"2015-06-23T12:48:20+00:00","mainEntityOfPage":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/"},"wordCount":9,"articleSection":["Wordpress"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/","url":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/","name":"PHP function to check that you are main page? - AndroidBubble Blog","isPartOf":{"@id":"https:\/\/androidbubble.com\/blog\/#website"},"datePublished":"2015-06-23T12:48:07+00:00","dateModified":"2015-06-23T12:48:20+00:00","author":{"@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7"},"breadcrumb":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/wordpress\/how-to-check-that-you-are-main-page\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/androidbubble.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Website Development","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/"},{"@type":"ListItem","position":3,"name":"PHP Frameworks","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/php-frameworks\/"},{"@type":"ListItem","position":4,"name":"Wordpress","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/php-frameworks\/wordpress\/"},{"@type":"ListItem","position":5,"name":"PHP function to check that you are main page?"}]},{"@type":"WebSite","@id":"https:\/\/androidbubble.com\/blog\/#website","url":"https:\/\/androidbubble.com\/blog\/","name":"AndroidBubble Blog","description":"Articles &amp; Posts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/androidbubble.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7","name":"Fahad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g","caption":"Fahad"},"sameAs":["http:\/\/www.androidbubbles.com\/","https:\/\/x.com\/phpFlex"],"url":"https:\/\/androidbubble.com\/blog\/author\/admin\/"}]}},"views":328,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/1963","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/comments?post=1963"}],"version-history":[{"count":2,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/1963\/revisions"}],"predecessor-version":[{"id":1965,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/1963\/revisions\/1965"}],"wp:attachment":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/media?parent=1963"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/categories?post=1963"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/tags?post=1963"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}