• Hi, forgive me if this has already been asked but I cant seem to find an answer and Im stuck on this. I just recently installed WordPress on my server and I plan to launch it as a blog within the next few days. This is my first attempt with WordPress, and my theme came out quite nicely. Here is what I am trying to do:

    When I go to my WordPress blog, I want the latest post to show in it’s entirety… but I want older posts that were made before the latest post to only show about 100 words or so, and then beneath that will be a “Continue Reading” link to continue to the post’s permalink. (example: www . hellyeahdude . com) As you can see in the example, the latest post is all on the front page, but the older posts only show a few sentences to save space.

    If anyone can show me how to do this, I would appreciate it very much. Thanks in advanced!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Couple options:

    1. Use the ‘more‘ quicktag in each post to define where your “Continue Reading” link is to display, then replace:

    <?php the_content(); ?>

    in your index.php (or home.php) template with:

    <?php
    if( !is_paged() && is_home() && ($post == $posts[0]) ) :
    	echo apply_filters('the_content', $post->post_content);
    else :
    	the_content('Continue Reading');
    endif;
    ?>

    The if statement tests on if we are *not* on a paginated page (i.e. page 2, page 3, etc), on the home or front page, and the loop is presently working on the first post in the $posts object ($posts[0]). If so, we bypass the functionality of the_content(), especially for the ‘more’ quicktag. Otherwise it operates as usual.

    2. If you choose not to use the ‘more’ quicktag, you can replace the_excerpt() (which displays a summary of the post) for the_content() on all posts but the first:

    <?php
    if( !is_paged() && is_home() && ($post == $posts[0]) ) :
    	the_content();
    else :
    	the_excerpt();
    ?>
    <a href="<?php the_permalink(); ?>">Continue Reading</a>
    <?php endif; ?>

    This is great information and it works fantastic.

    However, when I have 1 thumbnail picture at the top of every article, it won’t show the thumbnail in the “excerpt” on the front page.

    How can I get it to show the thumbnails on every post on the homepage?

    Thanks!

    Can anyone answer this?

    Option 1. Do not use the_excerpt().

    Option 2. Use the_excerpt(), but place what text you want displayed in it (including your image(s)) in the optional excerpt field of a post.

    Option 3. Use a plugin like my the_excerpt Reloaded:

    https://guff.szub.net/2005/02/26/the_excerpt-reloaded/

    Kafkaesqui thanks for this great solution.

    I was using on my blog, but recently when I upgraded to 2.5 it stopped working. I have double checked and verified the code is still there in my theme’s index.php file, but the homepage is still showing all excerpts.

    You can view it at https://www.whollysurrender.com.

    Here is some code from my theme’s index page:

    <div id="content">
    
            <?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div class="post" id="post-<?php the_ID(); ?>"> 
    
    				<h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
                               	<small><?php the_time('F jS, Y') ?> | <?php the_author() ?> </small>
    
    				<div class="entry">
    					<!--<?php the_content('Read the rest of this entry &raquo;'); ?>-->
    
    <?php
    
    if( !is_paged() && is_home() && ($post == $posts[0]) ) :
    	the_content('Read the rest of this entry &raquo;');
    else :
    	the_excerpt();
    ?>
    <a href="<?php the_permalink(); ?>">Continue Reading</a>
    <?php endif; ?>
    
    				</div>
    
    				<p class="postmetadata"><img src="<?php bloginfo('template_directory'); ?>/images/folder_edit.png" alt="category"></img>  <?php the_category(', ') ?>  <img src="<?php bloginfo('template_directory'); ?>/images/comments.png" alt="comments"></img>  <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> <?php edit_post_link('//Edit'); ?></p> 
    
    			</div>

    Any ideas why this code is not working with the new upgrade?

    Thanks for your help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Partial Posts’ is closed to new replies.