A user asked in Genesis Slack:
Can you give me a hint on how could I add a “Read More” button to the post excerpt?
Adding a Read more button below excerpts/content/content limit for every post in archives (Posts page, category archives etc.) of Genesis is as simple as adding
add_action( 'genesis_entry_content', 'custom_add_read_more' );
/**
* Add Read More button below post excerpts/content on archives.
*/
function custom_add_read_more() {
// if this is a singular page, abort.
if ( is_singular() ) {
return;
}
printf( '<a href="%s" class="more-link button">%s</a>', get_permalink(), esc_html__( 'Continue Reading' ) );
}
in child theme’s functions.php.
Replace Continue Reading
with your desired read more text.
Depending on the active theme, you may want to add a bit of CSS to add some space below the button.
.more-link {
margin-bottom: 30px;
}
HI, thanks for the tip. It worked perfectly. I just wanted to ask if you could tell me how to chenge the color of the button as well as the color when I point my cursor over the button.
Thanks in advance
Which child theme are you using?
Hi, figured it out. I am using the Sample theme and did it accidentally via Customizer. Thanks anyways
Worked great… is there any way to align the button to the center OR right side instead of left? And is there a way to modify its sizing?
You can float it right by adding this in your CSS:
Mofiying its size is also done via CSS. Ex.:
Perfect. However it does not seem to change the links on the featured posts. Do I need to add something? I have tried with no success. Thanks in advance.
You mean for posts that are output via the Genesis Featured Posts widget?
Yes on the home page i have added the widget to home bottom
Follow https://sridharkatakam.com/how-to-add-a-read-more-button-below-content-excerpts-in-genesis-featured-posts/.
Excellent help, thank you very much.
[…] the comments section of How to add a Read More button below content/excerpts in Genesis, a user […]
Hi Sridhar,
I was able to use this code & get the continue reading link. What I need now is how can I get the title of thee post to append to this continue reading link? For example it should be like continue reading sample post. This is important for accessibility to avoid lot of continue reading links for screen reader users.
Hi Raghava,
Replace
with
Thanks Sridhar. It worked.
Worked simple and easy, thanks! But now how can I remove the 3 little dots that show up at the end of the excerpt? They look like this: […] I’m trying to make the excerpts end at a specific point where they end after a few lines but only after a period or the end of a sentence.
It is possible via code to remove the three dots.
But based on what you wrote, it looks like a better suggestion would be to use manual excerpts. That way you have exact control of what appears in the excerpts.
If the Excerpt meta box is not visible in the post editor screen, click on Screen Options near the top right, enable it and fill up the excerpt.
Can I enter this code via Genesis Simple Hooks?
Not sure. I do not use it.
You could give it a try.
In the text area for
genesis_entry_content
hook, paste// if this is a singular page, abort.
if ( is_singular() ) {
return;
}
printf( '<a href="%s" class="more-link button">%s</a>', get_permalink(), esc_html__( 'Continue Reading' ) );
Great! Thank you 🙂