Previous posts link
-
Hi. This has already been discussed here. I’m using this theme layout, and when I try to display the “Next and Previous posts link”, it just doesn’t show. I’m sure I followed everything said in that post, but I don’t understand PHP, so I don’t know how to solve it.
Here is the code for the index.php and the home.php files:
index.php:
<?php get_header(); ?> <!-- begin colLeft --> <div id="colLeft"> <!-- begin colLeftInner --> <div id="colLeftInner" class="clearfix"> <!-- archive-title --> <?php if(is_month()) { ?> <div id="archive-title"> Browsing articles from "<strong><?php the_time('F, Y') ?></strong>" </div> <?php } ?> <?php if(is_category()) { ?> <div id="archive-title"> Browsing articles in "<strong><?php $current_category = single_cat_title("", true); ?></strong>" </div> <?php } ?> <?php if(is_tag()) { ?> <div id="archive-title"> Browsing articles tagged with "<strong><?php wp_title('',true,''); ?></strong>" </div> <?php } ?> <?php if(is_author()) { ?> <div id="archive-title"> Browsing articles by "<strong><?php wp_title('',true,''); ?></strong>" </div> <?php } ?> <!-- /archive-title --> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <!-- begin post --> <div class="blogPost"> <div class="date"><?php the_time('M') ?><br /><span><?php the_time('j') ?></span></div> <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1> <div class="meta"> By <span class="author"><?php the_author_link(); ?></span> // <?php the_category(', ') ?> // <?php comments_popup_link('No Comments', '1 Comment ', '% Comments'); ?> </div> <?php the_content(__('read more')); ?> </div> <!-- end post --> <?php endwhile; ?> <?php else : ?> <p>Sorry, but you are looking for something that isn't here.</p> <?php endif; ?> </div> <!-- end colLeftInner --> <div class="navigation"> <div class="alignleft"><?php next_posts_link() ?></div> <div class="alignright"><?php previous_posts_link() ?></div> </div> </div> <!-- end colLeft --> <?php get_sidebar(); ?> <?php get_footer(); ?>
and home.php:
<?php get_header(); ?> <!-- begin colleft --> <div id="colLeft"> <div id="colLeftInner" class="clearfix"> <!-- begin fetured post --> <?php query_posts('tag=featured');?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div id="featuredPost"> <span class="label">FEATURED POST</span> <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1> <div class="meta"> By <span class="author"><?php the_author_link(); ?></span> // <?php the_category(', ') ?> // <?php comments_popup_link('No Comments', '1 Comment ', '% Comments'); ?> </div> <div class="featuredDetails"><?php the_excerpt()?> <?php $featured_img = get_post_meta($post->ID, 'featured_img', $single = true); ?> <a href="<?php the_permalink(); ?>"><img src="<?php echo $featured_img ?>" border="0" alt="<?php the_title(); ?>" /></a> </div> </div> <!-- end featured post --> <?php endwhile; ?> <?php else : ?> <?php endif; ?> <?php wp_reset_query(); // for pagination ?> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // for pagination ?> <?php $posts_query = new WP_Query($query_string.'&tag=homepost&posts_per_page=-1&paged='.$paged); if(!$posts_query -> have_posts()){ $latestposts_no = get_option('designpile_latest_posts'); if($latestposts_no != null){ $posts_query = new WP_Query($query_string.'&posts_per_page='.$latestposts_no.'&paged='.$paged); }else{ $posts_query = new WP_Query($query_string.'&posts_per_page=6&paged='.$paged); } } $odd_or_even = 'odd'; ?> <?php if ($posts_query -> have_posts()) : while ($posts_query -> have_posts()) : $posts_query -> the_post(); ?> <div class="homePost <?php echo $odd_or_even; ?>"> <div class="date"><?php the_time('M') ?><br /><span><?php the_time('j') ?></span></div> <div class="meta"> By <span class="author"><?php the_author_link(); ?></span> // <?php comments_popup_link('No Comments', '1 Comment ', '% Comments'); ?> </div> <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2> <div><a href="#"><img src="<?php if ( function_exists('p75GetThumbnail') )echo p75GetThumbnail($post->ID); ?>" alt="" /></a><?php the_excerpt(); ?> </div> </div> <?php $odd_or_even = ('odd'==$odd_or_even) ? 'even' : 'odd'; ?> <?php endwhile; ?> <?php else : ?> <p>Sorry, but you are looking for something that isn't here.</p> <?php endif; ?> </div> <!-- end colleftInner --> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Older Entries'); // pagination ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »'); // pagination ?></div> </div> </div> <!-- end colleft --> <?php get_sidebar(); ?> <?php get_footer(); ?>
I’ll post it on pastebin if necessary, just tell me.
Thank you.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Previous posts link’ is closed to new replies.