• Hi all. So I’m having some trouble on a site. I need to have a bit of code that will pop a title onto a page based on which page it is. Here’s what I have now:

    <?php else : ?>
    	<header class="entry-header-global">
    	  <?php if ( is_page( 496971 ) ) { ?>
    	  <h1 class="entry-title inner">Events</h1>
    	  <?php } else { ?>
    		<h1 class="entry-title inner"><?php the_title(); ?></h1>
    		<?php } ?>
    	</header><!-- .entry-header -->
    	<?php endif; ?>

    This works for most pages, placing the title of the page(I assumed grabbed from <?php the_title(); ?>). The problem is that on both the events page and the blog page, the title position appears blank. The page title shows at the top of the browser windows fine. From what I can tell, the above code is telling every page to use the_title EXCEPT the events page, which will just show “Events”. However, if you view the site, the space is blank. I don’t really know much about php, so I don’t know where to troubleshoot.

    In addition, the blog page right now shows the title of the most recent post as the name of the main blog page. I was going to try using another “IF” statement to tell the Blog page to show “Blog” in the title spot for the blog page, but I have not yet gotten the events page working.

    Any ideas?

    this site can be seen here: cwp.wiredacres.com

  • The topic ‘PHP IF question’ is closed to new replies.