Support » Plugin: Feature A Page Widget » excerpt text linked to the featured page ?

  • Resolved panteror

    (@panteror)


    Hi,
    is it possible that the excerpt text should be linked to the featured page like the title and the image ?
    Thanks

    • This topic was modified 5 months, 2 weeks ago by  panteror.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author mrwweb

    (@mrwweb)

    Hi @panteror,

    You have a number of options.

    1st, don’t forget about the read more link. I doubt that’s exactly what you’re going for, but it may be helpful and it’s off by default.

    2nd, the fpw_excerpt filter allows you to write replace or modify the excerpt. I haven’t tested this, but this might work for you:

    function fpw_link_the_excerpt( $excerpt) {
        $new_excerpt = '<a href="' . get_the_permalink() . '">';
        $new_excerpt .= $excerpt;
        $new_excerpt .= '</a>';
        return $excerpt;
    }

    Test and use at your own risk 🙂

    Finally, you might consider creating a new template or modifying an existing one. If you really want the excerpt linked, you might modify a template so the entire widget is just wrapped in a single link.

    Good luck!

    Hi,
    I tested the fpw_excerpt filter in function.php, i add the line but it’s not working.

    I will try to understand the template system but it seems to be hard for my knowledge.

    Thanks

    Plugin Author mrwweb

    (@mrwweb)

    Sorry. That code was incomplete. Add this before it:

    add_filter( 'fpw_excerpt', 'fpw_link_the_excerpt' );

    Not working neither

    add_filter( 'fpw_excerpt', 'fpw_link_the_excerpt' );
    
    function fpw_link_the_excerpt( $excerpt) {
        $new_excerpt = '<a href="' . get_the_permalink() . '">';
        $new_excerpt .= $excerpt;
        $new_excerpt .= '</a>';
        return $excerpt;
    }

    It’s in the function.php of my theme, right ?

    Plugin Author mrwweb

    (@mrwweb)

    Dumb mistake on my part. Last line should be:

    return $new_excerpt;

    I tested and that works.

    Perfect Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.