Forum Replies Created

Viewing 8 replies - 16 through 23 (of 23 total)
  • Thread Starter Pete468

    (@pete468)

    Thanks for pointing me in the right direction.
    I’ve incorporated next_posts_link and previous_posts_link as per the example and it works as expected. Thanks!

    Thread Starter Pete468

    (@pete468)

    Thanks to both of you – that’s so kind!
    I think I understand how it’s supposed to work now – and the example code works exactly as I wanted it to – VERY grateful!!

    Thread Starter Pete468

    (@pete468)

    I thought that the current category was passed to the page by the previous page (i.e. in the URL) – and that a generic loop could display posts based on the current category (without a specific category being explicit in the code). I guess what you’re saying is that query_posts isn’t the code I should be using for my generic category template?

    Thread Starter Pete468

    (@pete468)

    Hi – I really appreciated the help last time – Thanks!
    I’m still having trouble with my category page loop. What I’m trying to do here is; display the category title, display the category description (if it exists), then display the full content of the latest post in that category, then display excerpts for the next x number of posts in that category, then display a “Next” link for the next page.
    I think I’ve misunderstood something about how the loop works, because my code sucessfully displays the category title and description, but then lists posts from ALL categories instead of the current category.

    Any help will be greatly appreciated! Here’s my code:

    <?php // Check if there are any posts to display
    				if ( have_posts() ) : ?>
    				<h1 class="archive-title"><?php single_cat_title( '', true ); ?></h1>
    		<?php if ( category_description() ) :  ?>
    		<h5 class="slug-line"><?php echo category_description(); ?></h5>
    		<?php endif; ?>
    		<hr>
    
    	<!--COLUMN 1-->
    		<div id="column1">
    			<h2 class="section-title">Latest Story</h2>
    				<?php query_posts('showposts=1&post_type=post'); ?>
    					<?php
    					// The Loop
    					while ( have_posts() ) : the_post();?>
    					<div class="item">
    					<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    					<small><?php the_time('F jS, Y') ?></small>
    
    					<div class="entry">
    					<?php the_content(); ?>
    
    					<p class="postmetadata"><?php _e( 'Posted in' ); ?> <em><?php the_category( ', ' ); ?> on <?php the_time('F jS, Y') ?></em></p>
    					</div>
    					<div class="comments-template">
    						<?php comments_template();?>
    					</div>
    					</div>
    					<?php endwhile;?>
    					<?php else : ?>
    				<p>Sorry - no posts found</p>
    			<?php endif; ?>
    
    			<?php rewind_posts(); ?>
    		</div><!--column-main-->
    
    		<div id="column2">
    		<h2 class="section-title">More Stories</h2>
    
    		<?php query_posts('showposts=10&offset=1&post_type=post'); ?>
    		<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    				<div class="item article-preview">
    				<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
    				<p class="date-stamp"><?php the_time('F jS, Y') ?></small></p>
    				<?php if ( has_post_thumbnail()) : ?>
    
    						<?php the_post_thumbnail('thumbnail', array('class' => 'articlethumb')); ?>
    
    					<?php endif; ?>
    
    				<div class="entry">
    
    				<?php the_excerpt(); ?>
    
    				<p class="postmetadata"><?php _e( 'Posted in' ); ?> <em><?php the_category( ', ' ); ?> on <?php the_time('F jS, Y') ?></em></p>
    				</div>
    				<div class="comments-template">
    					<?php comments_template();?>
    				</div>
    				</div>
    				<?php endwhile;?>
    					<div class="navigation">
    						<?php posts_nav_link();?>
    					</div>
    				<?php else : ?>
    			<p>Sorry - no posts found</p>
    		<?php endif; ?>

    Thread Starter Pete468

    (@pete468)

    Oh my word! Really? It works.
    I feel daft – Thanks a million for your help!

    Thread Starter Pete468

    (@pete468)

    <?php// Check if there are any posts to display
    				if ( have_posts() ) : ?>
    				<h1 class="archive-title"><?php single_cat_title( '', true ); ?></h1>
    		<?php if ( category_description() ) :  ?>
    		<h5 class="slug-line"><?php echo category_description(); ?></h5>
    		<?php endif; ?>
    		<hr>
    
    	<!--COLUMN 1-->
    		<div id="column-single">
    
    				<?php
    				// The Loop
    				while ( have_posts() ) : the_post();?>
    				<div class="item">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    				<small><?php the_time('F jS, Y') ?></small>
    
    				<div class="entry">
    				<?php the_content(); ?>
    
    				<p class="postmetadata"><?php _e( 'Posted in' ); ?> <em><?php the_category( ', ' ); ?> on <?php the_time('F jS, Y') ?></em></p>
    				</div>
    				<div class="comments-template">
    					<?php comments_template();?>
    				</div>
    				</div>
    				<?php endwhile;?>
    				<?php else : ?>
    			<p>Sorry - no posts found</p>
    		<?php endif; ?>
    Thread Starter Pete468

    (@pete468)

    no – but there are two in this bit

    Thread Starter Pete468

    (@pete468)

    Thanks for the suggestion – but that creates an error: “Parse error: syntax error, unexpected ‘else’ (T_ELSE) in archive.php on line 53”
    ..which is the else at the end of the loop.

Viewing 8 replies - 16 through 23 (of 23 total)