• Hi again!

    I was wondering if there is any way to show x number of words in an entry WITH formatting before automatically cutting off the entry and displaying a “More…” link? I’ve read that you can do this with formatting stripped, but I want to retain all formatting. Is it possible?

    Also, what does <?php the_content_rss('More...', FALSE, '', 50); ?> output? I tried that in hopes that it would show a More… link after 50 words, but that didn’t happen.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Sounds like you want to try “the excerpt reloaded” plugin. It replaces the function the_excerpt and is much more customizable.

    RSS is completely unrelated. You can read about that function here.

    or you can do it without a plugin. Just use the_content instead of the_excerpt in your themes index.php and then use the ‘more’ tag in your posts.

    Thread Starter Mew

    (@gokumew2)

    > Haecceity
    Thanks! I’m using it now. Do you know if there’s any way to have the more link align to the right? Or, have the link appear right after where the entry is cut off (instead of going to the next line)?

    > boober
    But the point is I don’t want to insert a more tag every time… I just wanted it done automatically.

    Interesting question:

    The code is something like this:

    <?php the_excerpt_reloaded(80, '<a><img><strong><em>', 'content', TRUE, 'Click to read more&nbsp;&raquo;', TRUE, 0, TRUE); ?>

    with the “Click to read…” text being what I’ve chosen as my “More” text. If you simply insert a line break at the start of the “more” parameter then it’ll appear on a new line:

    <?php the_excerpt_reloaded(80, '<a><img><strong><em>', 'content', TRUE, '<br />Click to read more&nbsp;&raquo;', TRUE, 0, TRUE); ?>

    At least it did for me when I just tested it.

    In theory you could instead put a <p> around the “more” parameter and give it whatever class in your CSS aligns text to the right. So in my case it would be:

    <?php the_excerpt_reloaded(80, '<a><img><strong><em>', 'content', TRUE, '<p class="textright">Click to read more&nbsp;&raquo;</p>', TRUE, 0, TRUE); ?>

    But the problem with this is it leaves an ellipsis (…) on the preceding line. You could probably edit the plugin to get rid of that, as long as you back up and know what you’re looking for.

    OK, line 129 in the plugin:

    $output .= ($showdots && $ellipsis) ? '...' : '';

    Edit out the three dots and you won’t get the ellipsis on the previous line, like so:

    $output .= ($showdots && $ellipsis) ? '' : '';

    That plus inserting <p> tags around the “more” text will give you what you want, as long as the p has a class that aligns the text to the right.

    Thread Starter Mew

    (@gokumew2)

    I don’t mind the ellipsis. I fond out how to format the more link position. It said how in the plugin documentation. I added

    .more-link {
       font-weight: bold;
       text-align: right;
    }

    to my template’s stylesheet and voila! The link is still in its own separate paragraph but oh well. It’s no biggie. Thanks for the help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display preview WITH formatting?’ is closed to new replies.