• Resolved henballs

    (@henballs)


    Hello World,

    I went to settings -> reading -> posts per page -> 5.

    Now I have 5 posts on every page. How do I make it so that my home page has 10 posts? and every other page remains 5 posts?

    Here’s my index.php

    <?php get_header(); ?>
    <div class="cont">
      <div class="main">
        <?php while ( have_posts() ) : the_post(); ?>
        <?php  if ( !is_paged() && ( $wp_query->current_post <= 2 ) ) : ?>
        <?php  if ( $wp_query->current_post == 0 ) : ?>
        <a href="<?php home_url(); ?>">
        </a>
        <div class="three_container">
        <?php endif; ?>
          <div class="newest" <?php post_class() ?>>
              <a href="<?php the_permalink() ?>">
                <?php the_post_thumbnail( array(280,280) ); ?>
              </a>
              <h2>
                <a href="<?php the_permalink() ?>">
                  <?php the_title(); ?>
                </a>
              </h2>
              <?php the_excerpt(); ?>
          </div>
        <?php  if ( $wp_query->current_post == 2  ) : ?>
        </div>
        <div class="sidebar-container">
          <div class="posts-container">
          <?php endif; ?>
          <?php else : ?>
    
          <div class="blog-posts" <?php post_class() ?>>
              <a href="<?php the_permalink() ?>">
                <?php the_post_thumbnail( array(180,180) ); ?>
              </a>
              <h2>
                <a href="<?php the_permalink() ?>">
                  <?php the_title(); ?>
                </a>
              </h2>
              <?php the_excerpt(); ?>
              <div class="entry-date">
                <p><?php echo get_the_date(); ?></p>
              </div>
          </div>
          <?php endif; ?>
          <?php endwhile; ?>
          </div>
        </div>
          <?php get_sidebar(); ?>
          <div class="old">
            <?php echo get_next_posts_link('Older Posts ?'); ?>
          </div>
        <?php get_footer(); ?>
      </div>
    </div>

Viewing 2 replies - 16 through 17 (of 17 total)
  • Thread Starter henballs

    (@henballs)

    Thanks, but now I just get one post per every page (home & page) after making those changes.

    function limit_posts_per_page() {
        if ( is_front_page() || is_home() )
          return 'LIMIT 0, 10';
      }
      add_filter('pre_option_posts_per_page', 'limit_posts_per_page');

    The The settings -> reading -> posts per page is now blank.

    Hmmmmmmm

    Thread Starter henballs

    (@henballs)

    Got it, thanks for all your help ya’ll!

    Use is_paged() and not is_page()

Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘How do I make the home page show 10 posts? Currently showing 5 Posts per page.’ is closed to new replies.