Forums

[resolved] custom excerpt change [...] to link and title (3 posts)

  1. djsteve
    Member
    Posted 2 years ago #

    Is there any way to change the [...] at the end of excerpts to instead be a read more link?

    I would love to have something like this:

    <?php the_content("...continue reading the story
    called " . get_the_title('', '', false)); ?>

    but does that only work with the_content it would be great to replace the [...] with the link to the excerpt post with the linked title. I fear many web users may miss the fact that they can click on the larger title at the top - this would be better imo

    If this has been asked and answered already I apologize.. I went through 200 posts in the search, and read several times the codex for the excerpt and read more customization - not sure how they mesh - still learning php and wp :)

  2. alchymyth
    The Sweeper
    Posted 2 years ago #

    wordpress+custom+excerpt+with+link

    one of the top search results:
    http://forum.bytesforall.com/showthread.php?t=269

    one of the answers in this article:
    add this to functions.php of your theme:

    //function to replace invalid ellipsis with text linking to the post
    function elpie_excerpt($text)
    {
       return str_replace('[...]', '<a href="'. get_permalink($post->ID) . '">' . ' [&hellip; Read More]' . '</a>', $text);
    }
    add_filter('the_excerpt', 'elpie_excerpt');

    or one of many plugins:
    http://wordpress.org/extend/plugins/custom-excerpts/

  3. djsteve
    Member
    Posted 2 years ago #

    Thank you for the help!
    I had not considered searching for those terms, and had not thought to search with google. I had also not thought about a plugin for this!
    I'm trying to sift though code and template tags and sheesh, Ijust hit myself on the head - a plugin.

    After looking at the plugin you mentioned above, I clicked on the tag for excerpt to see other plugins that worked with customizing the excerpt. I just tried 6 or 7 different plugins.

    The fancy excerpt plugin was the closest to being exactly what I wanted - with a couple of minor flaws in my opinion - but for many people it may do the trick.

    I found that the post teaser plugin allowed me to tweak the exact text and format that I need.

    thanks for leading me in other directions outside the code box I was stuck in!

Topic Closed

This topic has been closed to new replies.

About this Topic