The first 4 lines above form a custom function to control the amount of words that appear within each excerpt on a blog post. A function is defined and then a filter is added to set(execute) the function. As part of the WordPress API, we target the excerpt_length
function to optimize our post to be no more than 220 characters.
The second function customizes the read more link by overriding the WordPress default. Here I have added a link contained inside a div so we can style it. I’ll get to the styling in a bit, but with this code in place and saved you can head to your site and hopefully see something similar to what I have.
Our excerpts of each blog post have been modified by our function.
The default CSS styling of a link and post is represent automatically with our Divi 2.0 theme, so there’s only a little work left to be done to make the link a button.
We gave the anchor link within our functions.php file a class of view-full-post-btn
. With this I’ll add some CSS to target the link. Add the CSS below to the style.css
file within your theme to customize our link. Where you add it doesn’t matter, but adding it in a memorable area you can reference in the future is always wise.
learn spanish 7 days learn spanish 5 minutesTAGS
CATEGORIES