• Resolved skymningslage

    (@skymningslage)


    Al right, I have a site where I will post some articles from time to time. When at the first page I want people to see a full post per page, no worries there.

    When they click on a specific category, I want them to see all the posts in that category as excerpts on one single page or say 10-20 posts per page. Right now when they click on a category they see an excerpt but only one post per page.

    Do I change this in archive.php, category.php or functions.php?

    I run the theme Codium Extended.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter skymningslage

    (@skymningslage)

    Could this be the issue? (functions.php)

    // For category lists on category archives: Returns other categories except the current one (redundant)
        function codium_extend_cats_meow($glue) {
           $current_cat = single_cat_title( '', false );
           $separator = "\n";
           $cats = explode( $separator, get_the_category_list($separator) );
           foreach ( $cats as $i => $str ) {
              if ( strstr( $str, ">$current_cat<" ) ) {
                 unset($cats[$i]);
                 break;
              }
           }
           if ( empty($cats) )
              return false;
    
           return trim(join( $glue, $cats ));
        }
    Thread Starter skymningslage

    (@skymningslage)

    Any ideas?

    Thread Starter skymningslage

    (@skymningslage)

    I have been fiddling around in the code in archive.php and category.php, it ended up with me having to restore them. Any ideas on how to solve this?

    I think you may need to add a query to your archive page if this is something you want for all categories.
    I used this to get a long list of posts on a page,(no exceprts) – this is added to a custom Page template.

    `<?php query_posts(‘category_name=setlist&orderby=date&order=ASC&showposts=50’); ?>
    `
    hth

    Thread Starter skymningslage

    (@skymningslage)

    I tried that but it did not work or I put the code in at the wrong place.

    Thread Starter skymningslage

    (@skymningslage)

    This is archive.php (the first part anyway)

    <?php get_header( ); ?>
    	<div id="container">
    		<div id="content">
    
    			<h1 class="page-title">
    			<?php if ( is_day() ) : ?>
    							<?php printf( __( 'Daily Archives: <span>%s</span>', 'codium_extend' ), get_the_date() ); ?>
    			<?php elseif ( is_month() ) : ?>
    							<?php printf( __( 'Monthly Archives: <span>%s</span>', 'codium_extend' ), get_the_date('F Y') ); ?>
    			<?php elseif ( is_year() ) : ?>
    							<?php printf( __( 'Yearly Archives: <span>%s</span>', 'codium_extend' ), get_the_date('Y') ); ?>
    			<?php else : ?>
    							<?php _e( 'Blog Archives', 'codium_extend' ); ?>
    			<?php endif; ?>
    			</h1>
    			<div class="linebreak clear"></div>	
    
    			<?php if (have_posts()) : ?>
    			<?php rewind_posts(); while (have_posts()) : the_post(); ?>
    
    			<div class="dp100">
    			<span <?php body_class('cat-links'); ?>><?php printf(__('%s', 'codium_extend'), get_the_category_list(' ')) ?></span>
    			</div>

    Is it somewere here I change the code?
    I have been hearing about “loops” could that help?

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Posts per page in categories.’ is closed to new replies.