Forums

Extending the length of type per post... (7 posts)

  1. ShastaBert
    Member
    Posted 2 years ago #

    By default, my blog posts are only 4 lines of text before the "read more" box. I want this to be at least 12, maybe more, but after scouring code to find where this needs to be changed...I failed : (
    Can anyone tell me where to look so I can change this... PLEASE

    ShastaBert

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    You could drop a copy of your theme's index.php file into the WordPress pastebin and post the pastebin url here. Perhaps someone will be able to spot the problem and suggest a solution.

  3. ShastaBert
    Member
    Posted 2 years ago #

    Since it's short I thought I'd just drop it here, Thanks....

    <?php get_header(); ?>

    <!-- start content -->
    <div id="content">

    <?php if (have_posts()) : the_post(); ?>

    <div class="post" id="post-<?php the_ID(); ?>">
    <h1 class="title">" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h1>
    <p class="byline"><small><?php the_time('F jS, Y') ?> by <?php the_author() ?> <?php edit_post_link('Edit', '', ' | '); ?></small></p>
    <div class="entry">
    <?php the_excerpt(); ?>
    </div>
    <p class="meta">" class="more">Read More      <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »', 'comments'); ?></p>
    </div>

    <?php while (have_posts()) : the_post(); ?>

    <div class="post" id="post-<?php the_ID(); ?>">
    <h2 class="title">" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>
    <p class="byline"><small><?php the_time('F jS, Y') ?> by <?php the_author() ?> <?php edit_post_link('Edit', '', ' | '); ?></small></p>
    <div class="entry">
    <?php the_excerpt(); ?>
    </div>
    <p class="meta">" class="more">Read More      <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »', 'comments'); ?></p>
    </div>

    <?php endwhile; ?>

    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
    </div>

    <?php else : ?>

    <h2 class="center">Not Found</h2>
    <p class="center">Sorry, but you are looking for something that isn't here.</p>
    <?php include (TEMPLATEPATH . "/searchform.php"); ?>

    <?php endif; ?>

    </div>
    <!-- end content -->

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

  4. jonimueller
    Member
    Posted 2 years ago #

    The excerpt is hard coded into WordPress to be 55 characters long. I personally would prefer a setting expressed in LINES rather than characters.

    Nevertheless, you can alter that number across the board by placing this code into your functions.php file; just change "55" below to the number of your choice (it may take some trial and error):

    // POST EXCERPT LENGTH IS SET HERE
    function my_excerpt_length($text){
    return 55;
    }
    add_filter('excerpt_length', 'my_excerpt_length');
  5. ShastaBert
    Member
    Posted 2 years ago #

    Thank you for the info. I tried every way conceivable with no luck. I straight coded an ad in the middle of the paragraph and that's where it stopped. I'll just keep playin' till I learn what I need to know. I setup another site today with a different theme and it posted the entire post instead of just an excerpt so I'm pretty sure it's going to be in the theme code. Thanks again.

  6. ShastaBert
    Member
    Posted 2 years ago #

    I just thought I'd update this fix...

    I found this chunk of code in the main index page

    <div class="entry">
    <?php the_excerpt(); ?>
    </div>

    and I changed it to this....

    <div class="entry">
    <?php the_content('Read the rest of this entry »'); ?>
    </div>

    now it shows the whole post.

    I'd still like to know how to control the actual length for other site blogs. If anybody has any ideas I'd like to hear them.
    Thanks,
    ShastaBert

    http://idiotproofincomes.com

  7. jonimueller
    Member
    Posted 2 years ago #

    You can control the post length on a post-by-post basis using the More tag rather than an excerpt.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.