Title: is_home function &#8211; Same content, different pages
Last modified: August 18, 2016

---

# is_home function – Same content, different pages

 *  [functionjunkie](https://wordpress.org/support/users/functionjunkie/)
 * (@functionjunkie)
 * [20 years, 6 months ago](https://wordpress.org/support/topic/is_home-function-same-content-different-pages/)
 * Hi Everyone,
 * I’m having an issue with the is_home function…
 * In the post.php page, I have this function:
 * <h2 class="pagetitle"><?php if(is_home()) { echo 'pxLabs - Web and Interactive
   Agency'; } else { wp_title(''); echo' - Web and Interactive Agency'; } ?></h2
   >
 * However, on all my pages, it only displays (page title) – Web and Interactive
   Agency… I created a home.php file thinking that this might solve the problem 
   however, that wasn’t it.
 * Clearly there is something wrong with the code, but I can’t see it. Anyone have
   any ideas?
 * Thanks,
 * Justin

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [20 years, 6 months ago](https://wordpress.org/support/topic/is_home-function-same-content-different-pages/#post-291407)
 * I believe `is_home` would work in `index.php` or `home.php`.
 *  Thread Starter [functionjunkie](https://wordpress.org/support/users/functionjunkie/)
 * (@functionjunkie)
 * [20 years, 6 months ago](https://wordpress.org/support/topic/is_home-function-same-content-different-pages/#post-291467)
 * I tried using that code on index.php and home.php and it didn’t work.
 * It’s supposed to be used on page.php, but I cannot seem to get it to work properly.
 * Cheers!
 * Justin
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [20 years, 6 months ago](https://wordpress.org/support/topic/is_home-function-same-content-different-pages/#post-291550)
 * When I put your code in my `index.php` file, on my main blog page I see:
    pxLabs–
   Web and Interactive Agency
 * When I put your code in my `page.php` file, on my page id 28, I see:
    Parent 
   Page id28 – Web and Interactive Agency
 * Note: `Parent Page id28` is the name I’ve given that page for testing purposes.
 *  Thread Starter [functionjunkie](https://wordpress.org/support/users/functionjunkie/)
 * (@functionjunkie)
 * [20 years, 6 months ago](https://wordpress.org/support/topic/is_home-function-same-content-different-pages/#post-291617)
 * Michael,
 * Hmmm…. interesting… Here’s what I’ve got in my page.php:
 * <?php get_header(); ?>
    <div id="content"> <?php if (have_posts()) : while (have_posts()):
   the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2 class="pagetitle"
   ><?php if(is_home()) { echo 'pxLabs - Web and Interactive Agency'; } else { wp_title('');
   echo' - Web and Interactive Agency'; } ?></h2> <?php the_content(__('Read the
   rest of this page &raquo;')); ?> <?php wp_link_pages(); ?> <?php edit_post_link(
   __('Edit'), '', ' '); ?> </div> <?php endwhile; endif; ?> </div> <?php get_sidebar();?
   > <?php get_footer(); ?>
 * Cheers,
 * Justin

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘is_home function – Same content, different pages’ is closed to new replies.

## Tags

 * [is_home](https://wordpress.org/support/topic-tag/is_home/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [functionjunkie](https://wordpress.org/support/users/functionjunkie/)
 * Last activity: [20 years, 6 months ago](https://wordpress.org/support/topic/is_home-function-same-content-different-pages/#post-291617)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
