on index.php max 5 post, on archive pages all (4 posts)

  1. svenigson
    Posted 10 years ago #


    On my site http://svenigson.com I have the "Other recent topics" listing, and I want there maximum 5 post listed, but in the wp-admin I entered "show post: of the last 365days", becouse I want all the post displayed onthe archive pages. How can I do this???

    <?php if( $featured_post ) : ?>
    <?php foreach( $featured_post as $post ) : setup_postdata( $post ); ?>
    <?php $featured_post_id = $post->ID; ?>
    <div class="right">
    <div class="righttopunderline"></div>
    Read More
    " rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Read
    the whole entry

    Post Category
    <?php the_category(' / ') ?>

    Discuss this Entry
    <?php comments_popup_link('0 new comments', '1 new comment', '% new comments'); ?>

    RSS Feed
    <?php comments_rss_link('Follow trough RSS 2.0'); ?>
    <?php the_title(); ?>
    <div class="mainunderline"></div>
    <div class="entryindex">" rel="bookmark">
    <?php the_excerpt(); ?>
    <?php endforeach; ?>
    <?php endif; ?>
    <div class="right">
    <h1>Inspired by work</h1>
    <div class="rightunderline"></div>
    <?php get_links_list(); ?>
    <?php if (have_posts()) : ?>
    <h1>Other recent topics</h1>
    <div class="mainunderline"></div>
    <?php while (have_posts()) : the_post(); ?>
    <?php if( $post->ID == $featured_post_id ) continue; ?>
    <table width="350px" border="0" cellspacing="0" cellpadding="0" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #eeeeee;">
    <tr style="background-color: #ffffff;" onmouseover="this.style.backgroundColor='#fffeef';" onmouseout="this.style.backgroundColor='#ffffff';" >
    <td><div class="smallheader">" rel="bookmark">
    <?php the_title(); ?>
    <div class="smallmeta">Posted
    <?php the_time('Y-m-d') ?>
    | Comments to this topic
    <?php comments_popup_link('0', '1', '%'); ?>
    | <?php comments_rss_link('RSS 2.0'); ?> Feed
    Post category
    <?php the_category(' / ') ?>
    <?php endwhile; ?>
    <?php else : ?>
    <h1>Not Found</h1>
    <div class="mainunderline"></div>
    <div class="entryindex">Sorry, but you are looking for something that isn't here.</div>
    <?php endif; ?>

    This is the source in my index.php, I think here should I edit the loop, but how?

    Thx for info!

  2. svenigson
    Posted 10 years ago #

    Any ideas?

  3. moshu
    Posted 10 years ago #

    The "idea" is not to post code here (only small snippets in between backticks) because nobody ever bothers to take a look at it. Use http://pastebin.com and similar services. Thank you.

  4. MichaelH
    Posted 10 years ago #

    Couldn't you set Options->Reading Show at most to 5 posts then in your archive.php make use of the query_posts() template tag?

    I believe the Show at most x number of days does not really work and has been reported as a bug.

    Welcome to the WordPress Support Forums!

    Please help keep the Forums successful by reading:
    Using the Support Forums

    Also, remember the WordPress Codex and the FAQ pages.

    And, thank you, for letting us know if this information proves useful (or not)!

Topic Closed

This topic has been closed to new replies.

About this Topic