PHP Magic Book – Free PHP Scripts, Tutorials and Downloads, PHP AtoZ Reloaded, free php tutorials, free php downloads, php scripts, PHP tips

How To Display Some Content at Just Home Page and Single Post of Blog

Recently I wanted to display little about section me at my blog but just at home page and single post under sidebar. So how we can tell that we are at home page or at single post in case of WordPress Blog? Here is the code:

<?php if ( is_front_page() or is_home() or is_single() ) { ?>
Your content goes here.
<? } ?>

is_front_page() and is_home() both will server same purpose.
Put this code anywhere in your blog containing some content in the middle and it should display that content when just single post is viewed or home page of blog is being viewed.

  • Share/Bookmark
Tags: ,
Posted in: Hacks, WordPress
Post's RSS » RSS 2.0
Post's Comments RSS » RSS 2.0

Related Posts




2 Responses to “How To Display Some Content at Just Home Page and Single Post of Blog”

  1. Feb 15, 2009
    Devil Jin Says:

    Wonderful. :D

  1. 1 Trackback(s)

  2. Nov 30, 2008: Mixblog Team 2009 » Blog Archive How To Display Some Content at Just Home Page and Single Post of Blog

Post a Comment

  Subscribe Via RSS
  Subscribe Via Email