WordPress.org

Forums

Need help displaying more lines of my posts (4 posts)

  1. Rafael00
    Member
    Posted 6 years ago #

    Hi Fellow 'pressers,

    This is a long post, so I'll start with the question: what change do I need to make to my index.php so that when a reader clicks on a category or date on the calendar, the resulting displayed post shows more than 4 or 5 lines (ideally all lines).

    I am using the Neo-Sapien theme for my blog (http://www.tp79reunion09.com). In the theme, the loop as follows:

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    
    	<div class="post" id="post-<?php the_ID(); ?>">
    
    <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
    <div class="entry">
    
    <?php the_content('Read more…'); ?>
    
    <p class="postmetadata">
    <?php the_time('F jS, Y') ?>
    <?php _e('Categories:'); ?> <?php the_category(', ') ?> . <?php _e('Author:'); ?> <a href="<?php the_author_url(); ?>"><?php the_author(); ?></a> . <?php _e('Comments:'); ?> <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> <?php edit_post_link('Edit this entry', '', ''); ?>
    
    </div>
    
    	</div>
    
    <?php endwhile; ?>
    
    	<div class="navigation"><?php posts_nav_link('','','Previous page') ?> <?php posts_nav_link('','Next page','') ?></div>
    
    <?php else : ?>
    
    	<div class="post">
    <div class="post-title><h2><?php _e('Not Found'); ?></h2></div>
    <div class="entry"><?php _e('Sorry, but you are looking for something that isn't here.'); ?></div>
    	</div>
    
    <?php endif; ?>

    What do I change? If showing all lines isn't possible (or a good idea), how do I get the "read more" to show up? Right now there's a [...] where it cuts off but it's not a hyperlink.

    Thanks!

    Rafael

  2. Mark
    Member
    Posted 6 years ago #

    look in your theme's archive.php file or possible category.php file if your theme has the latter, and find something like the_excerpt() and change that to the_content() - either of those could be get_the_excerpt() or get_the_content() depending on how the theme is designed.

    the_excerpt() displays a portion of the post, the_content() displays then entire content of a post (or page depending on the template file).

  3. Rafael00
    Member
    Posted 6 years ago #

    Awesome! That solved it!

    For any other inexperienced people like me that may read this, changing the_excerpt to the content in category.php changes the way a post displayed after clicking on a category (duh) and when changing it in archive.php it changes it when clicking it on the calendar.

    Thanks a million wpsec!

  4. Mark
    Member
    Posted 6 years ago #

    Just keep in mind that if a theme doesn't have a category.php file then WordPress will use archive.php instead, if that one exists.

Topic Closed

This topic has been closed to new replies.

About this Topic