Hide text in CSS on all pages except homepage

  WordPress Plugins

In this example I wanted to show a hyper link on homepage, but all other pages I wanted to show just the text. So I created the following. For simplicity I used SPAN, but if you use a website builder, you can put class in any type module:

<span class=”home-page”><a href=”https://iLocalEverywhere.com” target=”_blank” rel=”nofollow”>iLocalEverywhere</a></span>
<span class=”other-pages”>iLocalEverywhere</span>

Here’s what the CSS looks like:

.home-page {display: none;}
.home .home-page {display: block !important;}

.home .other-pages {display: none;}

LEAVE A COMMENT