• Resolved east_sider

    (@east_sider)


    I’m using Twenty Eleven on my own server. What I need is a way for all Sub-Category Archive pages to show an unlimited amount of their post titles only. The homepage uses the Showcase template and – with ‘blog pages to show’ (in Settings > Reading) set to 4 – it shows what I need there so I don’t want to change the ‘blog pages to show’ setting. I’m OK with 4 post excerpts on the main Category Archive pages as well (the way it is now).

    I’m not real strong with PHP but I’m good at following directions! Thanks for any help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter east_sider

    (@east_sider)

    I found a way that works well and hope others find this useful. First make a copy of category.php and put it in your child theme folder. Name it “category-xxx.php” – where xxx is the slug name of the category (or number). Then, replace this part of the code:

    <?php /* Start the Loop */ ?>
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php
    						/* Include the Post-Format-specific template for the content.
    						 * If you want to overload this in a child theme then include a file
    						 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    						 */
    						get_template_part( 'content', get_post_format() );
    					?>
    
    				<?php endwhile; ?>
    
    				<?php twentyeleven_content_nav( 'nav-below' ); ?>
    
    			<?php else : ?>
    
    				<article id="post-0" class="post no-results not-found">
    					<header class="entry-header">
    						<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
    					</header><!-- .entry-header -->
    
    					<div class="entry-content">
    						<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
    						<?php get_search_form(); ?>
    					</div><!-- .entry-content -->
    				</article><!-- #post-0 -->
    
    			<?php endif; ?>

    with this:

    <?php /* Start the Loop */ ?>
    				<ul class="category">
    
    	<?php $archive_query = new WP_Query('cat=25&showposts=1000');
    	while ($archive_query->have_posts()) : $archive_query->the_post(); ?>
    	<li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li>
    
    	<?php endwhile; ?>

    And set ‘cat=25’ to the id number of your category. You will end up with a bulleted list of only the titles on your category or subcategory page.

    Thread Starter east_sider

    (@east_sider)

    Resolved by moi.

    ” put it in your child theme folder” I don’t know what this sentence means.Can you describe it a litter clearer?

    when I replace this part of the code, and open a category, it tells “Parse error: syntax error, unexpected $end in /home/northcam/public_html/wp-content/themes/twentyeleven/category-78.php on line 45”

    I’m totally new to PHP, so I can’t understand the code, can you send me a “category-xxx.php” so I can copy from it?

    My email is [email moderated – this forum does not provide support via email]

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Twenty Eleven – Show Only Titles on Category Archive Pages’ is closed to new replies.