<?php
//don't re-add
/**
*
* custom entry content : replace the archive content with your own build for the excerpt/content limit
*
*/
function yourprefix_do_custom_entry_content() {
if ( ! is_singular() ) :
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
add_action( 'genesis_entry_content', 'yourprefix_build_archive_entry_content' );
endif;
}
add_action( 'genesis_before', 'yourprefix_do_custom_entry_content' );
/**
*
* custom entry content for archives
*
*/
function yourprefix_build_archive_entry_content() {
//get the limit setting in Genesis Theme Settings
$limit = genesis_get_option( 'content_archive_limit', GENESIS_SETTINGS_FIELD );
//build the content with tags, balance the tags, and apply the limit to it
$content = get_the_content(); //the raw content unformatted
$content = preg_replace("/<img[^>]+\>/i", " ", $content ); // remove images
$content = preg_replace("/<embed[^>]+>/i", " ", $content, 1); // remove embeds
$content = apply_filters( 'the_content', $content ); //run the raw content though the filter to put the tags in
$content = str_replace(']]>', ']]>', $content); //remove shortcodes (a must)
$content = substr( $content, 0, $limit ); //apply the limit setting
$content = substr( $content, 0, strrpos( $content, ' ') ) . " …"; //add the ellipses
$content = force_balance_tags( $content ); //close any open tags
//remove links (optional) the link tag will close if the content clips at that tag.
$content = preg_replace('/<a href=\"(.*?)\">(.*?)<\/a>/', "\\2", $content );
//build readmore
$readmore = '<p><a href="' . get_permalink() . '">Continue Reading</a></p>';
echo $content . $readmore;
}