Content/Excerpt length control for a specific loop?

Is it possible to control the length of the content or excerpt for a specific query/loop? I have come across the following code, but this changes the length for all excerpts, I want it focused on a specific custom query. add_filter(‘excerpt_length’, ‘my_excerpt_length’); function my_excerpt_length($length) { return 20; } 2 Answers 2 Try this: http://pippinspages.com/tutorials/better-wordpress-post-excerpt-revamped/

the_excerpt(), get_the_excerpt() and the_content() all killing “the Loop”

Before I call the_excerpt(), the_permalink() displays the correct thing. Afterwards, it does not… <?php global $query_string; //strip out the “pagename=blog” so that the query will grab all of the posts instead of the content of the blog page $query_string = preg_replace(“/pagename=[a-zA-Z0-9]*/”, “”, $query_string); query_posts( $query_string . “posts_per_page=3” ); if ( have_posts() ) : while ( … Read more

How to correctly limit the content and strip HTML?

I have been using this code for a long time : $temp_arr_content = explode( ” “, substr( strip_tags( get_the_content() ), 0, 720 ) ); $temp_arr_content[count( $temp_arr_content ) – 1] = “”; $display_arr_content = implode( ” “, $temp_arr_content ); echo $display_arr_content; if( strlen( strip_tags( get_the_content() ) ) > 0 ) echo “…”; To limit my content … Read more

First letter cutting off in excerpt

I’m using a plugin to allow for dropcaps for the first letter in my WordPress theme. However, the excerpt is cutting off the first letter. For example, a sentence like: “This is a WordPress install” would display on the front page as “his is a WordPress install”. I tried stripping out the strip_shortcodes section of … Read more

Extending wordpress search to include excerpts and taxonomies?

Apologies for the lack of code, but I have no idea where to start with this – is it possible to extend WordPress’s search function to include excerpts and (custom) taxonomies as well as the standard title and post content in search results? i.e. search results don’t include posts that contain keywords found in excerpts … Read more

Get the excerpt for a post created by the related author

This has been bugging me for ages and can’t quite get it working. I’m using the following code in my functions file to enable me to display posts created by the same author as the current single post. function get_related_author_posts() { global $authordata, $post; $authors_posts = get_posts( array( ‘author’ => $authordata->ID, ‘post__not_in’ => array( $post->ID … Read more