WordPress.org

Ready to get started?Download WordPress

Forums

Display Read More Content with Line Breaks (4 posts)

  1. jnscollier
    Member
    Posted 2 years ago #

    On the homepage of my site, I am trying to display the content within the "Read More" summary to take into account line breaks.

    For example, if a post starts off like this:

    some phrase here 1
    some phrase here 2
    some phrase
    some phrase here 3
    some thing else here
    ...

    I want it to display in this format within the "Read More" section.

    It's currently displaying all smashed together like this:

    some phrase here 1 some phrase here 2 some phrase some phrase here 3 some thing else here

    Any ideas will help. Thanks

  2. Jacob Chappell
    Member
    Posted 2 years ago #

    Are you using the_excerpt to print the content in the read more section? because the_excerpt naturally compiles all the paragraphs together into one to output. If so, you should be able to hook into it somehow though and change it to keep whitespace maybe.

  3. jnscollier
    Member
    Posted 2 years ago #

    This is what I have in the Main Index Template - index.php

    <?php the_post_excerpt($excerpt_length=40); ?>
    </div><!-- POST CONTENT END -->
    <div class="readmore"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">Read More</a></div>

    This is what I have in the Theme functions - functions.php

    [code moderated - please use the pastebin for any code longer than 10 lines]

    I'm not so good with PHP and I'm not looking for any handouts here but if you or anyone could help me identify where to focus my search, that's be awesome. It looks like this is a custom read more function?

  4. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    You can control what html tags are stipped in the excerpt.

    See this previous post:

    http://wordpress.org/support/topic/dont-strip-certain-tags-in-excerpt?replies=9

Topic Closed

This topic has been closed to new replies.

About this Topic