Archived topic
"Read More" Button for Peak Site Library Theme
19 replies · Started by Hannah on June 23, 2021
I have just written 2 posts after utilizing Peak Theme from site library, but the "Read More" is not coming up on the Blog page. Could you please assist me
Hi Hannah,
Can you try adding this PHP snippet?
add_filter( 'generate_show_excerpt', function( $excerpt ) {
if ( has_excerpt() ) {
return true;
}
return $excerpt;
} );
Here's how to add PHP - https://docs.generatepress.com/article/adding-php/
Where is safest place to add this snippet? Just want to clarify correct placement
The methods here all work fine:
Adding PHP: https://docs.generatepress.com/article/adding-php/
That has not solved the issue.
Are you using the custom excerpt metabox?
If so this should help:
https://docs.generatepress.com/article/excerpt-issues/#read-more-label-or-button-not-showing
Yes I am using the excerpt box on the right hand column.
In customize section under blog I have the "read more" button checked with excerpt length being 10. I've also unchecked the show author, and show date. But those are still displaying as well.
So my settings don't seem to be doing what I have them set to do.
Try this PHP filter instead.
add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
function tu_excerpt_metabox_more( $excerpt ) {
$output = $excerpt;
if ( has_excerpt() ) {
$output = sprintf( '%1$s <p class="read-more-button-container"><a class="button" href="%2$s">%3$s</a></p>',
$excerpt,
get_permalink(),
__( 'Read more', 'generatepress' )
);
}
return $output;
}
Let us know how it goes.
This PHp worked for the "Read More" Button, Thank you kindly!
Any tips on getting the author name and date to go away, as I have the boxes unticked in same section as the original "read more" section tick box.
Hi there,
Those look like they're coming from the Page Hero inside a Header Element in "Appearance > Elements".
Let us know if you need more info :)
Hi Tom,
That header element is where I put the php for the "Read More" button. The only other code there is google analytics.
So I'm bit confused are where to fiddle with next to get the author and date to go away.
Also,
The recent posts section in a normal post at the bottom, is not displaying like the site library's version.
Essentially I downloaded this site library theme so it would act/look like the site library version. But after only 3 posts I seem to be having trouble getting it to look like that.
Hi there,
if you go to Appearance > Elements there should be an element titled: Single Posts
Edit that and remove the date and and author from there.
And for the recent posts - the site was recently updated to make use of the Block element - and was also updated to use the Recent Posts Widget With Thumbnails plugin that you can install from the WP Repo. Then replace the recent posts widget in the sidebar with the one for that plugin.
David, Thank you heaps!
One last question and then I will get back to content creation. Is is possible to utilize the "recent posts" set-up that is in the newer Crypto site library theme? I've used inspector to look at the code (still quite a novice myself), but see two separate flex containers. Would find this method of recent posts heaps better for mobile readers.