• I have a blog with quite a few long winded authors.

    I’ve asked repeated to use the “more” button. But they either ignore me or forget.

    Is there a tag or hack that will automatically insert it after certain amount of characters, or words, or lines?

    Apologzing in advance if this topic has been answered. I have found the question asked a few times, but I never see the answer I’m looking for.

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • I haven’t come across any such hack yet, but I can’t imagine that it’s that tought to implement. If WordPress can automatically add <P>’s to every message, it can easily be made to add a <!–more–> tag after a certain count.

    Would make for a nice plugin..I’ll see what I can do.

    Regards

    Thread Starter mystic_bovine

    (@mystic_bovine)

    Wow. That would be great. Thanks!

    Pfft! Plugin-shmugin.

    Open you index.php file (this is assuming 1.2.X) find the code where the_content() is located. Replace it with the following:
    <?php if (!$single) {
    the_excerpt();
    } else {
    the_content();} ?>

    Now, on the main page, the excerpt will be displayed. The excerpt can be entered by hand (using the advanced post controls) or it will take the first section of the post itself (up to 200 words, I think).

    Tg

    I think mystic_bovine wants this to be done automatically when other users post.

    As cypher says, this isn’t hard to make. Just inserting the ‘more’ is really easy. There are some things to watch out for though.
    1) Suppose you have it set automatically after x words, but you make a short post (x+1 words). In that case you would want to prevent the ‘more’ insertion.
    2) If tags are used they will brake. So you would have to close them. Eg a ‘more’ between ‘strong’ tags will make your page be all strong since it won’t be closing anymore.

    Thread Starter mystic_bovine

    (@mystic_bovine)

    Thanks TechGnome,

    I tried your suggestion and it worked. It put ‘…’ after so many words, but it didn’t put in a link to take the reader to the rest of the story.

    I know you can click on the title to take you there, but some may not think of that. (I know I didn’t the first time I looked at the page – 🙂

    Thanks again.

    @mystin_bovine,

    Email me at abihari_@_gmail.com, I’ve got a small plugin for you try out. Perhaps we can refine this with a bit of testing and fix the noteworthy issues that dissurion has mentioned.

    Regards

    Try this…..

    <a href="<?php the_permalink() ?>" rel="bookmark">...Read the rest</a>

    right after the_excerpt();

    so it looks like this:


    <?php if (!$single) {
    the_excerpt(); ?><a href="<?php the_permalink() ?>" rel="bookmark">...Read the rest</a><?php
    } else {
    the_content();} ?>

    Tg

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Auto “more”’ is closed to new replies.