Plugin Author
mrwweb
(@mrwweb)
Should be hard. As you can see, the filter passes two argument, $excerpt
and $featured_page_id
. That second lets you do all sorts of fun stuff.
If this is a one-off change and you need to test for the page’s ID, you can do that by replacing XX with the page’s ID in the snippet below:
function fapw_read_more( $excerpt, $featured_page_id ) {
if( $featured_page_id == XX ) {
$fapw_read_more_text = 'Services';
} else {
$fapw_read_more_text = 'Read More';
}
return $excerpt . '</p><p class="read-more-wrapper"><a class="read-more-link" href="' . get_permalink( $featured_page_id ) . '">' . $fapw_read_more_text . '</a>';
}
add_filter( 'fpw_excerpt', 'fapw_read_more', 10, 2 );
Or, you may really just want to repeat the title of the page:
function fapw_read_more( $excerpt, $featured_page_id ) {
$fapw_read_more_text = 'Continue Reading "' . get_the_title( $featured_page_id ) .'"…';
return $excerpt . '</p><p class="read-more-wrapper"><a class="read-more-link" href="' . get_permalink( $featured_page_id ) . '">' . $fapw_read_more_text . '</a>';
}
add_filter( 'fpw_excerpt', 'fapw_read_more', 10, 2 );
That would change “Read More…” to “Continue Reading “Services”…”
Those are just two options. With the ID, you can do just about anything you want. For instance, you could make a custom field to store read more text for the page and then grab it with get_post_meta()
.
Plugin Author
mrwweb
(@mrwweb)
@laughhearty
Please let me know if this worked for you and I can mark it “resolved” or whether you’re still having trouble. I’m happy to help if you’re still stuck!
Yes,
it’s taken this long to back to this thread. I’ve been so BUSY with other projects.
Just wanted to officially state:
This works like a charm!
Thanks again. I love this plugin and have waiting for something like this to come along in a long time!