{"id":8226,"date":"2013-02-26T21:09:04","date_gmt":"2013-02-26T21:09:04","guid":{"rendered":"http:\/\/2slick.com\/web\/?p=8226"},"modified":"2013-03-17T01:13:23","modified_gmt":"2013-03-17T01:13:23","slug":"display-div-only-on-home-page-wordpress","status":"publish","type":"post","link":"https:\/\/2slick.com\/web\/display-div-only-on-home-page-wordpress\/affordablewebsitestips\/tutorials","title":{"rendered":"Display div only on home page, WordPress"},"content":{"rendered":"<p>In this tutorial, I will show you how to display a div tag on the homepage of your WordPress website or blog.<\/p>\n<ol>\n<li>First you will need to edit the 'Header.php' file of your WordPress website<span style=\"font-size: 13px; line-height: 19px;\">. For instruction on how to <span style=\"text-decoration: underline;\"><a title=\"edit header wordpress\" href=\"http:\/\/2slick.com\/web\/modify-wordpress-header-html\/affordablewebsitestips\/tutorials\" target=\"_blank\">edit your Header.php file using WordPress click here<\/a><\/span>.<\/span><\/li>\n<li>Inside your header.php filemarkup section, enter the code:\n<p><!--DEVFMTCODE--><pre class=\"devcodeblock\" title=\"PHP\"><table class=\"devcodetools\"><tbody><tr><td>&nbsp;PHP&nbsp;|&nbsp;<\/td><td style=\"background-image:url('https:\/\/2slick.com\/web\/wp-content\/plugins\/devformatter\/img\/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;\"\/><embed id=\"ZeroClipboard1\" src=\"https:\/\/2slick.com\/web\/wp-content\/plugins\/devformatter\/_zclipboard.swf\" loop=\"false\" menu=\"false\" quality=\"best\" bgcolor=\"#ffffff\" width=\"16px\" height=\"16px\" align=\"middle\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application\/x-shockwave-flash\" pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\" flashvars=\"id=1&width=16&height=16\" wmode=\"transparent\" \/><\/td><td>&nbsp;copy&nbsp;code&nbsp;|<\/td><td style=\"cursor:pointer\" title=\"DevFormatter Plugin\" onclick=\"devfmt_credits()\">?<\/td><td width=\"99%\">&nbsp;<\/td><\/tr><\/tbody><\/table><div class=\"devcodeoverflow\"><table class=\"devcodearea\" width=\"100%\"><tr><td class=\"devcodelines\" width=\"1%\">1<\/td><td class=\"devcodelinesarea\"><pre class=\"devcode devcodeline\"><\/pre><\/td><\/tr><tr><td class=\"devcodelines devcodelinesodd devcodelinesodd\" width=\"1%\">2<\/td><td class=\"devcodelinesarea devcodelinesareaodd devcodelinesareaodd\"><pre class=\"devcode devcodeline\"><span style=\"color: #000000; font-weight: bold;\">&lt;?<\/span> <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>is_home<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#123;<\/span> <span style=\"color: #000000; font-weight: bold;\">?&gt;<\/span><\/pre><\/td><\/tr><tr><td class=\"devcodelines\" width=\"1%\">3<\/td><td class=\"devcodelinesarea\"><pre class=\"devcode devcodeline\"><span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span><\/pre><\/td><\/tr><tr><td class=\"devcodelines devcodelinesodd devcodelinesodd\" width=\"1%\">4<\/td><td class=\"devcodelinesarea devcodelinesareaodd devcodelinesareaodd\"><pre class=\"devcode devcodeline\">Hello World<\/pre><\/td><\/tr><tr><td class=\"devcodelines\" width=\"1%\">5<\/td><td class=\"devcodelinesarea\"><pre class=\"devcode devcodeline\"><span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span><\/pre><\/td><\/tr><tr><td class=\"devcodelines devcodelinesodd devcodelinesodd\" width=\"1%\">6<\/td><td class=\"devcodelinesarea devcodelinesareaodd devcodelinesareaodd\"><pre class=\"devcode devcodeline\"><span style=\"color: #000000; font-weight: bold;\">&lt;?<\/span> <span style=\"color: #009900;\">&#125;<\/span> <span style=\"color: #000000; font-weight: bold;\">?&gt;<\/span><\/pre><\/td><\/tr><tr><td class=\"devcodelines\" width=\"1%\">7<\/td><td class=\"devcodelinesarea\"><pre class=\"devcode devcodeline\"><\/pre><\/td><\/tr><\/table><\/div><\/pre><!--END_DEVFMTCODE--><\/li>\n<li>Save your changes.<\/li>\n<\/ol>\n<p>The 'is_home()' function is a built in WordPress function that checks if the visitor is on the homepage or not. This script will echo 'Hello world' only if the visitor is on the home page.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, I will show you how to display a div tag on the homepage of your WordPress website or blog. First you will need to edit the &#8216;Header.php&#8217; file of your WordPress website. For instruction on how to edit your Header.php file using WordPress click here. Inside your header.php filemarkup section, enter the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":8139,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,492,6],"tags":[670,69],"class_list":["post-8226","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-websites-2","category-wordpress","tag-home-page","tag-wordpress-2"],"_links":{"self":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts\/8226","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/comments?post=8226"}],"version-history":[{"count":8,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts\/8226\/revisions"}],"predecessor-version":[{"id":8231,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts\/8226\/revisions\/8231"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/media\/8139"}],"wp:attachment":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/media?parent=8226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/categories?post=8226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/tags?post=8226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}