Forums

[resolved] 1 post on homepage, 10 in archives? (5 posts)

  1. BakingandBooks
    Member
    Posted 2 years ago #

    I'd like to display 1 post on my homepage and 10 in the archives pages, but I'm not sure how do to that. I'm using the Elegant Themes Who's Who theme and when you set the reading options to 1 in the dashboard (so that 1 post shows on the front page) it automatically changes the number of posts shown in the archives.

    See what I mean at my site: Baking and Books

    Anyone know how to change the number of posts shown in the archives?

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    For post per page on index, mutliple post per page on archives...with the Settings->Reading Blog pages show at most at 10, using the WordPress Default theme, in wp-content/themes/default/index.php, just before this line: <?php if (have_posts()) : ?>

    add this to cause one (1) post on the 'index' posts display:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('showposts=1&paged='.$paged);
    
    ?>

    You'll need to look at the Elegant theme's index.php to place the code in correct place...

  3. BakingandBooks
    Member
    Posted 2 years ago #

    Thank you MichaelH!

    Could you help me figure out where to put this bit of code? The index.php for my theme calls two php files blogstyle.php and category.php.

    <?php get_header(); ?>
    <div id="container"><div id="left-div"><div id="left-inside">
    
     <?php if (get_option('artsee_format') == 'Blog Style') { ?>
    <?php include(TEMPLATEPATH . '/includes/blogstyle.php'); ?>
    <?php } else { include(TEMPLATEPATH . '/includes/category.php'); } ?>
    
    </div></div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    </body>
    </html>

    I think blogstyle.php is the one I'd have to modify since it appears to call individual posts... it looks like this:

    <?php if (have_posts()) : while (have_posts()) : the_post();
      if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    
    <div class="home-post-wrap2">
    
    <!--Begin Post-->
    <div class="single-entry">
    
    <h1 class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title() ?></a></h1>
    <div class="post-info">Posted by <?php the_author() ?> in  <?php the_category(', ') ?> on  <?php the_time('F jS, Y') ?> |  <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?><br />
    
    <?php if(function_exists('wp_print')) { print_link(); } ?> | <a href="http://www.bakingandbooks.com/feed/"><img src="http://www.bakingandbooks.com/wp-content/themes/WhosWho/images/rss_feed.png" border="0"></a> Enjoy this post? <a href="http://www.bakingandbooks.com/feed/">Subscribe to Baking and Books.</a>
    
    </div>
    
    <?php the_content(); ?>
    
    <div style="clear: both;"></div>
    </div>
    </div>
    <!--End Post-->
    
    <?php endwhile; ?>
    
    <div style="clear: both;"></div>
    
    <?php else : ?>
    
    <?php endif; ?>

    Any ideas where I should add the code you suggested?

  4. MichaelH
    Volunteer
    Posted 2 years ago #

    That looks right---
    ..../includes/blogstyle.php

    right before this:

    <?php if (have_posts()) : while (have_posts()) : the_post();
  5. BakingandBooks
    Member
    Posted 2 years ago #

    That did it! Thank you again MichaelH. :) :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.