WordPress.org

Forums

[resolved] 'posts_per_page=-1' problem in query_posts() (1 post)

  1. colt
    Member
    Posted 2 years ago #

    Hi,

    I want to get all posts in a category. To do this, I use the following functions but it is a white page.

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $counter = 1000;
    $args= array(
    	  'cat' => '1',
    	  'paged' => $paged,
    	  'showpost' => '1000',
    	  'posts_per_page' => $counter
    	 );
    query_posts($args);

    this was working fine two days ago but now it not working. So I tried the following code and I got the same error.

    query_posts( array ( 'category_name' => 'my-category-slug', 'posts_per_page' => -1 ) );
    or
    query_posts( array ( 'cat' => 1, 'posts_per_page' => -1 ) );

    if posts_per_page value is more than the number of posts, is the same problem.

    The following code works fine but paging is.I don't want paging.

    $counter = 100;
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    	'cat' => '1',
    	'showposts' => '100',
    	'paged' => $paged
    );
    query_posts($args);

    Can you help for the problem ?

    [No bumping. If it's that urgent, consider hiring someone.]

Topic Closed

This topic has been closed to new replies.

About this Topic