Created
August 1, 2013 01:11
-
-
Save ChrisCree/6127685 to your computer and use it in GitHub Desktop.
Some examples on how to customize the read more link in the Genesis framework.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add Read More button to blog page and archives | |
add_filter( 'excerpt_more', 'wsm_add_excerpt_more' ); | |
add_filter( 'get_the_content_more_link', 'wsm_add_excerpt_more' ); | |
add_filter( 'the_content_more_link', 'wsm_add_excerpt_more' ); | |
function wsm_add_excerpt_more( $more ) { | |
return '<div class="more-link"><a href="' . get_permalink() . '" rel="nofollow"><span>Read More</span></a></div>'; | |
} | |
// The three filters should cover most instances when you'd want the Read More link. | |
// You can comment out the one(s) you don't need. | |
// Notice that we wraped the link in a div to give more positioning control | |
// and the span adds an extra element for styling purposes | |
// The default Genesis code looks more like this: | |
return '<a class="more-link" href="' . get_permalink() . '" rel="nofollow">Read More</a>'; | |
// To add elipses just do this: | |
return '... <a class="more-link" href="' . get_permalink() . '" rel="nofollow">Read More</a>'; | |
// You can also add elipses in the first example with the div, like this: | |
return '... <div class="more-link"><a href="' . get_permalink() . '" rel="nofollow"><span>Read More</span></a></div>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment