Created
July 3, 2014 15:45
-
-
Save graylaurenm/15e8c82496b88867447a to your computer and use it in GitHub Desktop.
Create Clickable Excerpts in Genesis http://oncecoupled.com/2014/07/03/create-clickable-excerpts-genesis/
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 link at beginning of excerpt */ | |
add_filter( 'genesis_entry_content' , 'lgd_clickable_open', 1 ); | |
function lgd_clickable_open() { | |
if (is_home() || is_front_page() || is_archive() ) { | |
printf( '<a href="%s" alt="%s">', get_permalink(), the_title_attribute( 'echo=0' ) ); | |
} | |
} | |
/* end link at end of excerpt */ | |
add_filter( 'genesis_entry_content' , 'lgd_clickable_close', 11 ); | |
function lgd_clickable_close() { | |
if (is_home() || is_front_page() || is_archive() ) { | |
printf( '</a>' ); | |
} | |
} |
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
/* These styles are specific to my theme. You will want to adjust them for your own theme: */ | |
/* essentially remove any link styling from the text, but add it back to the excerpt's link. */ | |
.home .entry-content a, | |
.archive .entry-content a { | |
color: #333; | |
text-decoration: none; | |
} | |
.home .entry-content .read-more, | |
.home .entry-content .more-link, | |
.archive .entry-content .read-more, | |
.archive .entry-content .more-link { | |
color: #aaa; | |
text-decoration: underline; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment