wpsmith / genesis-sandbox-featured-content-widget

Genesis Sandbox Featured Content Widget. Based on Nick Croft's Genesis Featured Widget Amplified for additional functionality which allows support for custom post types, taxonomies, and extends the flexibility of the widget via action hooks to allow the elements to be re-positioned or other elements to be added.
39 stars 21 forks source link

Add Read more link when using Excerpt #31

Closed mbootsman closed 10 years ago

mbootsman commented 10 years ago

Hi,

is it possible to force the plugin to show the read more link (or give the option to show it) when Excerpt is selected as Content Type in the widget?

mbootsman commented 10 years ago

Hi, any thoughts on when or how this can be fixed?

I have tried debugging this, but it seems the function that is triggered by the add_filter commend does not work.

I have the widget set up using the excerpt, maximum words 10, read more text is set and the cutoff text is set to "..."

The read more link is not showing at all.

weslinda commented 10 years ago

I would also be interested in this. I'd like to simply be able to force the read more link when using an excerpt. Perhaps a checkbox that allows me to enable the Read More link. Being given the option would be awesome.

mbootsman commented 10 years ago

Found a solution, use the "the_excerpt" filter to add a read more link to the excerpt. example:

/* custom excerpt function for the homepage */
function excerpt_read_more_link( $output ) {
    if ( is_home() ) {
        global $post;
        return $output . '<a class="readmore" href="' . get_permalink( $post->ID ) . '" title="' . get_the_title( $post->ID ) . '">Read more ... </a>';
    } else {
        return $output;
    }
}

add_filter( 'the_excerpt', 'excerpt_read_more_link', 1 );

Closing this ticket.