Forums

Show past entries on previous pages (2 posts)

  1. jamieoliver22
    Member
    Posted 3 years ago #

    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" />&nbsp;<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Permalink</a>&nbsp;&nbsp;<img src="http://alpha-lite.co.uk/wp-content/themes/alpha-lite-brown/images/icons/letter.gif" />&nbsp;<a href="mailto:?Subject=Alpha-Lite - <?php the_title(); ?>&body=<?php the_permalink(); ?>">Email</a>&nbsp;&nbsp;<img src="http://alpha-lite.co.uk/wp-content/themes/alpha-lite-brown/images/icons/comments.gif" />&nbsp;<?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" />&nbsp;<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Permalink</a>&nbsp;&nbsp;<img src="http://alpha-lite.co.uk/wp-content/themes/alpha-lite-brown/images/icons/letter.gif" />&nbsp;<a href="mailto:?Subject=Alpha-Lite - <?php the_title(); ?>&body=<?php the_permalink(); ?>">Email</a>&nbsp;&nbsp;<img src="http://alpha-lite.co.uk/wp-content/themes/alpha-lite-brown/images/icons/comments.gif" />&nbsp;<?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 am by no means an expert in PHP, but I know enough to get around. Any help would be appreciated, thank you.

  2. jamieoliver22
    Member
    Posted 3 years ago #

    No one?

    I was wondering if an IF statement could be wrapped around it, checking whether the user is on page 1 or not, and show the relevant posts.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.