Skip to content

Instantly share code, notes, and snippets.

@carasmo
Last active October 29, 2016 20:27
Show Gist options
  • Save carasmo/f6e72a88c56145d2cf2bb1525bd72686 to your computer and use it in GitHub Desktop.
Save carasmo/f6e72a88c56145d2cf2bb1525bd72686 to your computer and use it in GitHub Desktop.
Read More for all reasons Genesis
<?php
/**
*
* Read More :: the_content_more_link
* when full content is chosen in Genesis Settings and user has added <!--more-->
* Don't add paragraphs
*
*/
function yourprefix_more_content_more_link( $more_link ) {
global $post;
//* if the standard, default <!--more--> is used, then replace with the setting
if( strstr( $post-> post_content,'<!--more-->')) {
return sprintf( ' <a href="%s" class="more-link">%s</a>', get_permalink(), __( yourprefix_read_more(), 'bloompro' ) );
} else { //* return the custom made read more that the editor created
return $more_link;
}
}
add_filter( 'the_content_more_link', 'yourprefix_more_content_more_link' );
/**
*
* Content Limit Read More link closing paragraph
*
*/
function yourprefix_content_read_more_link() {
return sprintf( '&hellip;</p>%s',
yourprefix_content_limit_read_more()
);
}
add_filter( 'get_the_content_more_link', 'yourprefix_content_read_more_link' );
/**
*
* Content Limit Read More link opening paragraph
*
*/
function yourprefix_content_limit_read_more() {
return sprintf( '<p class="more"><a class="more-link" href="%s">%s</a>',
get_permalink(),
apply_filters( 'yourprefix_read_more_text', __( yourprefix_read_more(), 'bloompro' ) )
);
}
/**
*
* Excerpt Read More
*
*/
function yourprefix_excerpt_read_more_link( $output ) {
return $output . yourprefix_excerpt_read_more();
}
add_filter( 'the_excerpt', 'yourprefix_excerpt_read_more_link' );
/**
*
* Excerpt read more (makes a new paragraph)
*
*/
function yourprefix_excerpt_read_more() {
return sprintf( '<p class="more"><a class="more-link" href="%s">%s</a></p>',
get_permalink(),
apply_filters( 'yourprefix_read_more_text', __( yourprefix_read_more(), 'bloompro' ) )
);
}
/**
*
* Add ellipsis to Excerpt
*
*/
function yourprefix_get_ellipsis() {
return '&hellip;';
}
add_filter( 'excerpt_more', 'yourprefix_get_ellipsis' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment