Skip to content

Instantly share code, notes, and snippets.

@carasmo
Created March 31, 2016 14:25
Show Gist options
  • Save carasmo/1d18cc93d8e82a8fd9e30477b93d68b1 to your computer and use it in GitHub Desktop.
Save carasmo/1d18cc93d8e82a8fd9e30477b93d68b1 to your computer and use it in GitHub Desktop.
Read More outside the paragraph
<?php
//don't include this
/** ====================================================================================
* Break more link outside the paragraph in the loop on all archives (home, archives, search, etc)
==================================================================================== **/
function yourprefix_excerpt_more_link() {
// Remove More Link from get_the_excerpt()
function more_link() {
return '';
}
add_filter('excerpt_more', 'more_link');
//New excerpt
function get_read_more_link() {
$excerpt = get_the_excerpt();
return '<p>' . $excerpt . '&nbsp;...&nbsp;</p> <p class="your-class-goes-here"><a href="' . get_permalink() . '">Read&nbsp;More</a></p>';
}
add_filter( 'the_excerpt', 'get_read_more_link' );
}
add_action( 'after_setup_theme', 'yourprefix_excerpt_more_link' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment