WordPress.org

Ready to get started?Download WordPress

Forums

<more> tag conflicts with using the_excerpt(); (6 posts)

  1. obrien317
    Member
    Posted 5 years ago #

    I have been trying to display my excerpts as summaries of the full text pages and thus have started using:

    <?php the_excerpt(); ?>

    in place of

    <?php the_content(); ?>

    This is all fine and working. However, now that I have the_excerpt being used, if I do not have an excerpt explicitly stated under the advanced posting options, the text from the main area will be displayed. This is fine, however, the <!--MORE--> tag will no longer work and link to my pages in the desired pages in this area now being displayed.

    When using the_excerpt the MORE tag will not link for your main text if you do not have an excerpt explicitly stated.

    Additionally the text area will not make links active either. (although the excerpt area will)

    Any ideas for a work-around fix for this?

    I want to use the_excerpt and if I choose to not add a summary, I would like for the <!-more-> tags from the_content area to work along with working links by default....

    Any ideas on this if clause?

  2. Ivovic
    Member
    Posted 5 years ago #

    can't do it... basically the excerpt is a cleaned up version of your post.

    if you want, you can easily put a link in after each excerpt using the_permalink(), which will act as a defacto more link. It won't really respect the more tag location, but if you want that, then don't use excerpts.

    Basically, if you want it to be nice all the time, then you'll have to either use more tags all the time, and not use excerpts -- or you'll have to explicitly write an excerpt for each post.

    If you want to, you can play with the_content_rss() which allows you to specify how many words should be automatically displayed, instead of using the_excerpt which always shows 55 words.

    A cleverly inserted permalink tag after that should sort of do what you want.

  3. obrien317
    Member
    Posted 5 years ago #

    Well the idea behind having an excerpt is that a summary will be displayed that isn't a part of the actual text, which is suited for RSS feeds.

    I just wish there were a way to go back to the default the_content pending that there isn't a the_excerpt available.

    I would just think that there would be a quick PHP if clause to facilitate the switch off.

    -Patrick

  4. obrien317
    Member
    Posted 5 years ago #

    You see, the problem once again is that if there is not an excerpt, using the_excerpt, and there is just text in the content area,

    the <more> tag will stop any further text from being displayed. However, permalink and other links do not work or even show up in the text area.

    <?php the_permalink(); ?> = no workey

  5. obrien317
    Member
    Posted 5 years ago #

    bumpany php pros around ^^

  6. guvnrDOTcom
    Member
    Posted 5 years ago #

    er, just saw this - probably a bit late for obrian but, for anyone else wondering, I think Ivovic meant for him to use something like ...

    <a class="more" href="<?php the_permalink() ?>" title="Read <?php the_title(); ?>">More</a>

    ...using .more to style the link.

Topic Closed

This topic has been closed to new replies.

About this Topic