WordPress.org

Forums

Show 1 post followed by titles (3 posts)

  1. seejee
    Member
    Posted 6 years ago #

    I have a couple of questions.

    i have created a new category page (category-3.php) to be different. on this page i want the newest post from said category to show the post title as well as the content. below that i want only the post titles and meta data showing for the other posts in the category. what i'm having trouble with is limiting the top so that only 1 post shows in full. then getting my theme to call up all the posts in the category after in their title view.

    it should look something like this

    ----
    POST TITLE 1
    content for post 1
    april 0, 00

    POST TITLE 2
    april 0, 00
    POST TITLE 3
    april 0, 00
    POST TITLE 4
    april 0, 00
    ----

    also, i don't mind if the newest post shows up again in the bottom section.
    hope that makes sense, if it doesn't let me know

    thanks in advance.

  2. stvwlf
    Member
    Posted 6 years ago #

    Hi

    change the_content in your code from something like this
    <?php the_content('Read the rest of this entry &raquo;'); ?>

    to something like this
    `<?php if ($wp_query->current_post == 0) {
    the_content('Read the rest of this entry »');
    }

    that should only display the content on the 1st post

  3. seejee
    Member
    Posted 6 years ago #

    hey sorry i'm really new to the wordpress structure. everytime i try adding that my page just loads white. this is the part of my custom category page that needs to be edited. the way i have it right now loads the post titles perfect but i can't get the newest post to load at the top.

    <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    
    			<div class="post" id="post-<?php the_ID(); ?>">
    
    				<h2><a href="<?php the_permalink(); ?>" title="<?php the_title() ?>"><?php the_title(); ?></a></h2>
    
    				<div class="entry">
    
    					<?php the_content(); ?>
    
    					<p class="postmetadata">
    Posted on: <strong><?php the_time("l F dS Y") ?>, <?php the_time() ?></strong><br />
    <?php _e('Filed under:'); ?> <strong><?php the_category(', ') ?></strong> <?php _e('by'); ?> <strong><?php  the_author(); ?></strong><br />
    <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?>
    					</p>					
    
    				</div>
    
    			</div>
    
    		<?php endwhile; ?>
    
    				<div class="navigation">
    						<?php posts_nav_link(); ?>
    				</div>
    
    		<?php else : ?>
    
    				<div class="post">
    						<h2><?php_e('Not Found') ?></h2>
    				</div>
    
    		<?php endif; ?>

    i guess while i'm asking to.. is there anyway to make the next post/previous post links stay within the same category?

Topic Closed

This topic has been closed to new replies.

About this Topic