need to add an excpetion to filter the_excerpt for a the_content excerpt
-
Hi I have an auto generated excerpt using the filter below.
It works great. I just have one category of posts for featured images that needs to use the content for the excerpt using the <!–more–> quick tag. Right now it doesn’t work because it gets overwritten by the excerpt filter. I’d like to do this in the functions file because the loop is generated in a plug in. I tried declaring a global more but it didn’t work.add_filter('the_excerpt', 'excerpt_read_more_link'); function custom_excerpt_length( $length ) { return 20; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); function new_excerpt_more( $excerpt ) { return str_replace( '[...]', '...', $excerpt ); } add_filter( 'wp_trim_excerpt', 'new_excerpt_more' ); ?>
tried this:
<?php global $more; // Declare global $more (before the loop). $more = 1; // Set (inside the loop) to display all content, including text below more. the_content(); ?>
Here is the loop from within a plugin php file:
…if(have_posts()) : while(have_posts()) : the_post(); ?> <div> <h2><a>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <div class="entry-summary"> <?php echo strip_tags(get_the_content('Read more...')); ?> </div> <div class="slideimage"> <a>"><?php the_post_thumbnail(); ?></a> </div> </div> <?php endwhile; endif; wp_reset_query(); ?>
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘need to add an excpetion to filter the_excerpt for a the_content excerpt’ is closed to new replies.