WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] help! need category to return all posts, not just 10 most recent! (6 posts)

  1. ankatank
    Member
    Posted 4 years ago #

    i'm working on designing and building my portfolio site with wordpress:
    ankatankdesign.com/makes

    when you click a section (category) - let's just look at "print," it shows the problem the best: http://ankatankdesign.com/makes/some/print/

    it's returning only the top ten projects (posts) in the section (category). there should be 11 showing. that number will grow though, and I'd like there to be no limit, no pagination, just a page that's as long as it needs to be to show all the posts.

    my "sidebar-right.php" code is what is displaying the categories on the print page that we're looking at. Can anyone see from my sidebar code, what I would need to do/change make it show all posts, not just the ten most recent? thanks in advance!

    the sidebar code is:

    <div id="secondary" class="sidebar-CAT">
    
    	<?php $cat_title = single_cat_title('',false);
                if (!$cat_title=='') {
    
                if ( !empty($categorydesc) ) echo apply_filters( 'archive_meta', '<div class="archive-meta">' . $categorydesc . '</div>' );
                    }
             ?> 
    
    	<?php  
    
                if(is_single()) {
    
                     $category = get_the_category();
    
                     query_posts('category_name=' . $category[0]->cat_name); 
    
                } else {
    
                     query_posts('category_name=' . single_cat_title(false, false));
                }
    
            while (have_posts()) : the_post(); ?>
    
           		<div id="sidebarCAT"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="http://www.aaank.com/images/post_thumbs/<?php $values = get_post_custom_values("theThumb"); echo $values[0]; ?>" alt="<?php the_title(); ?>" /></a>
    
                <div class="underThumbTxt"><?php if (strlen($post->post_title) > 15) {
                       echo substr(the_title($before = '', $after = '', FALSE), 0, 15) . '...'; } else {
                       the_title();
                 } ?></div>
    
               </div>
    
    		<?php endwhile; wp_reset_query(); ?>
    
           	<br style='clear:both;' />	
    
    </div>
  2. MichaelH
    Member
    Posted 4 years ago #

    To your query_posts() statements add the posts_per_page=-1 argument.

  3. ankatank
    Member
    Posted 4 years ago #

    hi, thanks so much for your response!

    i don't really know php that well, just what i'm picking up form learning wordpress, so i'm not totally sure what the right syntax is for adding the posts_per_page=-1 argument.

    i tried this but it caused everything to break...

    if(is_single()) {
    
         $category = get_the_category();
    
         query_posts('category_name=' . 'posts_per_page=-1' . $category[0]->cat_name); 
    
    } else {
    
         query_posts('category_name=' . 'posts_per_page=-1' . single_cat_title(false, false)); 
    
            }

    what am i doing wrong?

  4. ankatank
    Member
    Posted 4 years ago #

    oh.... then i tried this, but now, every category pulls in ALL posts, not just the ones from its own category... but this must be closer? any idea what to change to makes sure it only pulls in stuff from its own category?

    if(is_single()) {
    
        $category = get_the_category();
    
        query_posts('category_name=&posts_per_page=-1' . $category[0]->cat_name); 
    
    } else {
    
        query_posts('category_name=&posts_per_page=-1' . single_cat_title(false, false)); 
    
    }
    
            while (have_posts()) : the_post(); ?>
  5. MichaelH
    Member
    Posted 4 years ago #

    query_posts('posts_per_page=-1&category_name=' . $category[0]->cat_name); 
    
    .
    .
    .
    query_posts('posts_per_page=-1&category_name=' . single_cat_title(false, false))
  6. ankatank
    Member
    Posted 4 years ago #

    THANK YOU!!! works perfectly!!!!

Topic Closed

This topic has been closed to new replies.

About this Topic