Support » Fixing WordPress » any way of directly making the “[…]” in excerpts a link?

  • I’ve searched and found some discussions on adding a link after the excerpt, but what about in the excerpt itself? I can’t find where the excerpt and the […] is defined though. Does anybody know?

Viewing 6 replies - 1 through 6 (of 6 total)
  • “Faked” excerpts (excerpts extracted from post content) are done through the wp_trim_excerpt() function in functions-formatting.php in the wp-includes directory.

    Excellent. thanks.

    so it must be this:
    if (count($words) > $excerpt_length) {
    array_push($words, '[...]');
    $text = implode(' ', $words);
    return $text;

    I tried to make it a link using
    <a href="<?php the_permalink() ?>" rel="bookmark">[...]</a> in the array_push part, but it does not treat the php script as php; so clearly i’m not really sure what i’m doing

    Try this modification:

    $permadots = '[<a href="' . get_permalink($post->ID) . '">...</a>]';
    array_push($words, $permadots);

    Note to newly minted hackers: Back up any source files before editing them, and comment your changes for future reference, i.e.:

    // Skeary: ellipsis now permalink ($permadots)
    $permadots = '<a href="' . get_permalink($post->ID) . '">[...]</a>';
    array_push($words, $permadots);

    works great! thanks a lot.

    good point about the newly minted hackers.. though as i’ve already not been doing that quite a lot, it might be too late to salvage.

    interesting, you’d think something like this would be operational by default….

    Thanks. I also wandered how to do that. Works great!

    A related question: How can I change the functions-formatting.php so that images are displayed on the front page (when there is no text in the entry or when the image is placed before the text)? Is this possible? Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘any way of directly making the “[…]” in excerpts a link?’ is closed to new replies.