• 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)
  • I believe is_home would work in index.php or home.php.

    Thread Starter functionjunkie

    (@functionjunkie)

    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

    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

    (@functionjunkie)

    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.