Support » Fixing WordPress » Amount of Posts per page

  • Resolved KconleyK

    (@kconleyk)


    For my category pages, I have them set to show excerpts, and only put two lines of typing per post. On the category page there at the bottom you have to go to next page to see the last few posts. Is there away to change the default? So instead of 20 posts per page I can make it 50 or whatever number I find looks the best?

    http://www.AverageGuyGolf.com

Viewing 11 replies - 1 through 11 (of 11 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    <?php
    $args = array(
        'numberposts'     => 50,
      );
    
    $posts_array = get_posts( $args );
    ?>
    Thread Starter KconleyK

    (@kconleyk)

    Wow you are just helping me all day today. Put this in my archive.php file correct?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Yes or the template you want to display the posts

    Thread Starter KconleyK

    (@kconleyk)

    Didn’t work I put the below in my page.php file and archive.php didn’t work with either

    <?php
    $args = array(
    ‘numberposts’ => 50,
    );

    $posts_array = get_posts( $args );
    ?>

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Can you post your archive.php files’ contents?

    Thread Starter KconleyK

    (@kconleyk)

    That is a lot of code, what is the website I go to for that?

    Thread Starter KconleyK

    (@kconleyk)

    `<?php get_header(); ?>
    <div id=”container”>
    <?php if (is_category(‘Golf Course Reviews’)) : ?>
    <?php elseif (is_category(‘Category B’)) : ?>
    <p></p>
    <?php else : ?>
    <p></p>
    <?php endif; ?>
    <?php if(have_posts()): ?>
    <?php $adcount = 1; ?>
    <?php while(have_posts()):the_post(); ?>
    <div class=”post”>
    <h2><a href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>”>
    <?php the_title(); ?>
    </a></h2>
    <div class=”entry”>
    <?php if ($count == 1) : ?>
    <?php endif; $count++; ?>
    <?php if( is_category( ‘golf-wars’ ) ) the_content();
    else the_excerpt();?>
    <p class=”postmetadata”>
    <?php if(function_exists(‘wp_gdsr_render_article’)){ wp_gdsr_render_article(); } ?>
    <?php _e(‘Tags:’); ?>
    <?php the_category(‘, ‘) ?>
    <?php _e(‘by’); ?>
    <?php the_author(); ?>
    <br />
    <?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?>
    <?php edit_post_link(‘Edit’, ‘ | ‘, ”); ?>
    </p>
    <?php if ($adcount == 3) : ?>
    <?php
    $args = array(
    ‘numberposts’ => 50,
    );

    $posts_array = get_posts( $args );
    ?>
    <center><script type=”text/javascript”><!–
    google_ad_client = “ca-pub-7545639328816787”;
    /* Category Ads */
    google_ad_slot = “9432147552”;
    google_ad_width = 468;
    google_ad_height = 60;
    //–>
    </script>
    <script type=”text/javascript”
    src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”&gt;
    </script></center>

    <?php endif; $adcount++; ?>
    </div>
    </div>
    <?php $adcount++; ?>
    <?php endwhile; ?>
    <div class=”postnav”>
    <?php posts_nav_link(); ?>
    </div>
    <?php else: ?>
    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <h2>
    <?php _e(‘Not Found’); ?>
    </h2>
    </div>
    <?php endif; ?>
    </div>
    <?php get_sidebar(); ?>
    </div>
    <?php get_footer() ?>
    </body></html>

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    The archive.php file should be viewable from the admin panel -> appearance -> editor

    I just want to see where you put the code in, and where it should be.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Sorry I’m not sure how to implement it.

    Thread Starter KconleyK

    (@kconleyk)

    No Problem thanks for trying

    Thread Starter KconleyK

    (@kconleyk)

    I ended up getting a plugin that shows more pages in a clearer way at the bottom of the page.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Amount of Posts per page’ is closed to new replies.