Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8857109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:30:47+00:00 2026-06-14T14:30:47+00:00

In my index.php I use this code to limit the posts per page and

  • 0

In my index.php I use this code to limit the posts per page and it works without any problems:

$showposts = 5;
$do_not_show_stickies = 1;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('category__in' => $cat, 'showposts' => $showposts, 'ignore_sticky_posts' => 1, 'paged' => $paged);

$loop2query = new WP_Query($args);

query_posts($args); if(have_posts()) : while (have_posts()) : the_post(); ?>

<div class="blogpost"> ... </div>

<?php endwhile; endif;
posts_nav_link(); // Navigating the pages with $showposts each. ?>

The same code did not work in category.php so I changed it to the following but it still does not work:

$showposts = 4;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

if (have_posts()) { while (have_posts()) { the_post(); ?>
    <div class="blogpost"> ... </div>

<?php } }

else { ?>
    <p>There are no blog posts in this category.</p>
<?php } ?>

<?php posts_nav_link(); // Navigating the pages with $showposts each. ?>

I tried to change the line with if(have_posts()) : while (have_posts()) : the_post(); ?> [...] in category.php to make it similar to that line in index.php but nothing I tried worked.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:30:49+00:00Added an answer on June 14, 2026 at 2:30 pm

    WordPress has a setting for this, found in the admin area under SETTINGS -> READING -> Blog pages show at most

    You can use this instead of custom-modifying your queries. It may make it a little easier to maintain your project down the road.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this code http://www.openjs.com/scripts/events/keyboard_shortcuts/index.php for handling keyboard shortcuts. shortcut.add(Ctrl+Z,function() { setTimeout(function() { var
index.php has this jquery code which loads notifications.inc.php into a div on the page
I have a website that use this style : /index.php?page=45&info=whatever&anotherparam=2 I plan to have
can anybody help me solve this : i got $filename= index 198.php; i use
I have a function that I use on index.php page and I would like
I use JEditable for making edit field which following code: $(function() { $(.field).editable(http://localhost/index.php/welcome/update_record, {
i have used this code in my index.php to get user facebook first name
I have an index.php with this code <div id=example class=functions></div> <script type=text/javascript> var ajax_load
Some applications use this code as FIRST LINE on every page included by the
I've a problem when use this code in my page: Code with expire session

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.