• Resolved ankatank

    (@ankatank)


    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: https://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="https://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>
Viewing 5 replies - 1 through 5 (of 5 total)
  • To your query_posts() statements add the posts_per_page=-1 argument.

    Thread Starter ankatank

    (@ankatank)

    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?

    Thread Starter ankatank

    (@ankatank)

    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(); ?>
    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))
    Thread Starter ankatank

    (@ankatank)

    THANK YOU!!! works perfectly!!!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘help! need category to return all posts, not just 10 most recent!’ is closed to new replies.