Need help? Check out our Support site, then


Show past entries on previous pages

  1. Hey,

    After finding a code on the net, I have managed to set my homepage to style the first 'main-entry' post different than the rest ('past-entry'). Now this works perfectly fine, however I am unable to see previous results on the previous pages. Would it be possible to change this code so that on all previous pages it shows the 'past-entry's?

    My index.php:

    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     */
    
    get_header(); ?>
    
    	<div id="content" class="narrowcolumn">
    
    <!-- set main-entry -->
    <?php query_posts('showposts=1'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
     <div class="main-entry">
         <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
     	 <div class="topdate"><?php the_time('F jS, Y'); ?> <?php edit_post_link('- Edit', '', ''); ?></div>
         <?php
             the_content('Read more...');
         ?>
     <div class="share"><img src="http://alpha-lite.co.uk/wp-content/themes/alpha-lite-brown/images/icons/download.gif" /> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Permalink</a>  <img src="http://alpha-lite.co.uk/wp-content/themes/alpha-lite-brown/images/icons/letter.gif" /> <a href="mailto:?Subject=Alpha-Lite - <?php the_title(); ?>&body=<?php the_permalink(); ?>">Email</a>  <img src="http://alpha-lite.co.uk/wp-content/themes/alpha-lite-brown/images/icons/comments.gif" /> <?php comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)'); ?></div>
     </div>
     <?php endwhile; endif; ?>
    <!-- end main-entry -->
    
    <!-- set past-entry -->
    <?php query_posts('showposts=5&offset=1'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
     <div class="past-entry">
             <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
             <div class="topdate"><?php the_time('F jS, Y'); ?> <?php edit_post_link('- Edit', '', ''); ?></div>
             <?php
                the_excerpt();
             ?>
     <div class="share"><img src="http://alpha-lite.co.uk/wp-content/themes/alpha-lite-brown/images/icons/download.gif" /> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Permalink</a>  <img src="http://alpha-lite.co.uk/wp-content/themes/alpha-lite-brown/images/icons/letter.gif" /> <a href="mailto:?Subject=Alpha-Lite - <?php the_title(); ?>&body=<?php the_permalink(); ?>">Email</a>  <img src="http://alpha-lite.co.uk/wp-content/themes/alpha-lite-brown/images/icons/comments.gif" /> <?php comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)'); ?></div>
     </div>
     <?php endwhile; endif; ?>
     <!-- end past-entry -->
    
     <div style="float:left; padding-top:30px;"><?php previous_posts_link('<img src="http://alpha-lite.co.uk/wp-content/themes/alpha-lite-brown/images/icons/arrow_back.gif" /> Previous posts') ?></div><div style="float:right; padding-top:30px;"><?php next_posts_link('Next posts <img src="http://alpha-lite.co.uk/wp-content/themes/alpha-lite-brown/images/icons/arrow_next.gif" />') ?></div>
    
    	</div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    URL: http://alpha-lite.co.uk/

    I was thinking, is there any way an IF statement could be wrapped around it, to check whether the user is on the first page or not and display the relevant posts?

    I am by no means an expert in PHP, but I know enough to get around. Any help would be appreciated, thank you.

    The blog I need help with is alpha-lite.co.uk.

  2. The blog you specified at alpha-lite.co.uk does not appear to be hosted at WordPress.com.

    This support forum is for WordPress.com hosted blogs only. If you have a self-hosted WordPress blog you need to seek help at the WordPress.org forums, not here.

    If you don't understand the difference, you may find this information helpful.

  3. The .org forums don't work and my posts don't show up...

  4. We can't help you with .org questions. Our software works quite differently. We can't do that coding, for instance.

Topic Closed

This topic has been closed to new replies.

About this Topic