Issue with Loop/Content not showing on Home Page
-
Hi –
I’m having some issues with my blog and suspect that it might be the php code in my loop. I’m running multiple loops to display recent articles and latest results.
I have specific widgets in my sidebar that are only supposed to show on the index page, but since modifying the theme, they will not display. Also, I tried adding a test conditional tag for display on the home page, but to no avail.
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.
This is the code that I am currently using in my index file:
<?php get_header(); ?> <div id="page"> <div id="contentleft"> <?php if ( $paged < 2 ) { // 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><br /><br /> <?php the_excerpt(); ?><?php endwhile; ?> <strong>More Stories:</strong><br /> <?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(); ?>
Thanks! Feel free to let me know if you need any more information.
- The topic ‘Issue with Loop/Content not showing on Home Page’ is closed to new replies.