I'm having some minor trouble with my theme.
I made some modifications to the loop on the home page, but for some reason, I can't get any conditional tags to display text just on the home page. I don't know if I've got some type of incorrect code in the loop, but after installing some sample php code in the far right sidebar, I'm not getting it to display.
This is what my index file is using:
<?php get_header(); ?>
<div id="page">
<div id="contentleft">
<?php if ( is_home()) { // Do stuff specific to first page?>
<?php include (TEMPLATEPATH . '/features.php'); ?>
<div id="content">
<h2 class="darkgreen">CONTENT</h2>
<div class="homep">
CONTENT
</div>
<h2 class="black">FIRST LOOP SECTION</h2>
<div class="homep">
<?php
$otherPosts = new WP_Query();
$otherPosts->query('showposts=3&cat=199');
while($otherPosts->have_posts()) : $otherPosts->the_post();
?>
<strong><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></strong><?php the_excerpt(); ?>
<?php endwhile; ?></div>
<h2 class="lightgreen">SECOND LOOP SECTION</h2>
<div class="related">
<?php $temp_query = $wp_query; ?>
<?php query_posts('category_name=wta-tennis&showposts=1'); ?>
<?php while (have_posts()) : the_post(); ?>
<?php if (get_post_meta($post->ID, post_thumbnail)) { ?><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php echo get_post_meta($post->ID, post_thumbnail, true); ?>" class="post-thum" alt="post thumbnail" /></a>
<?php } ?><font size="+1"><strong><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></strong></font>
<?php the_excerpt(); ?><?php endwhile; ?>
<strong>More Stories:</strong>
<?php $posts = get_posts('category=83&numberposts=15&offset=1');
foreach ($posts as $post) : start_wp(); ?>
<ul><li><a href="<?php echo get_permalink() ?>"><?php the_title(); ?></a></li></ul>
<?php endforeach; ?>
</div>
<h2 class="lightgreen">CONTENT</h2>
<div class="related">
CONTENT
</div>
<?php } else { // Do stuff specific to non-first page ?>
<div id="content">
<h2 class="sectionhead">Recent Articles</h2>
<?php if (have_posts()) : while (have_posts()) : the_post();
if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php if (get_post_meta($post->ID, post_thumbnail)) { ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php echo get_post_meta($post->ID, post_thumbnail, true); ?>" class="post-thum" alt="post thumbnail" /></a>
<?php } ?>
<div class="entry">
<?php the_excerpt(); ?>
</div>
<div class="navigation">
<div class="alignleft">
<?php next_posts_link('« Previous Entries') ?>
</div>
<div class="alignright">
<?php previous_posts_link('Next Entries »') ?>
</div>
</div>
</div>
<?php endwhile; endif; ?>
<?php } ?>
</div>
<?php include (TEMPLATEPATH . "/sidebar1.php"); ?>
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
Also this is the test code in the sidebar which is not displaying:
<?php if (is_home()) { ?>
test
<?php } ?>
If someone could help me out, I would really appreciate it! Although I've been playing around with WordPress for several years, I'm very much a newbie when it comes to custom loops.
THANK YOU!