Tag Info

New answers tagged

2

COMPLETE GUIDE TO EXCERPTS I've recently answered a few questions regarding excerpts, so I' going to give a detailed explanation covering as much as I can. HTML TAGS/FORMATTING the_excerpt() first of all doesn't except any parameters, so nothing can be passed to it. In is a fact that the_excerpt() trims the content to 55 words, and all html tags are ...


0

Here is my version, keeping all html tags and also trimming the content after the last word in of a sentence if ( ! function_exists( 'pietergoosen_custom_wp_trim_excerpt' ) ) : function pietergoosen_custom_wp_trim_excerpt($pietergoosen_excerpt) { global $post; $raw_excerpt = $pietergoosen_excerpt; if ( '' == $pietergoosen_excerpt ) { ...


0

kaiser gave an excellent answer so I'm just adding this for general info. There is another way to approach this as well. If you need the use for multiple excerpts, you can just make use of wp-trim_words. You just need to replace the_excerpt(); with echo custom_excerpts($limit); where $limit is the amount of words. function custom_excerpts($limit) { ...


0

As toscho stated, types_render_field() is not a wordpress function, so you should have declared it somewhere. HTML tags are stripped before returning the excerpt, whether you are using wp_trim_excerpt or wp_trim_words. If you need to keep HTML formatting in the excerpt, you will need to create your own excerpt function. To do this, you will first need to ...


0

Well, I found it: function get_the_excerpt_filter( $excerpt ) { $wordToRemove = "Introduction"; $len = strlen($wordToRemove); if(substr($excerpt, 0, $len) == $wordToRemove){ $excerpt = trim(substr($excerpt, $len)); } return $excerpt; } add_filter( 'get_the_excerpt', 'get_the_excerpt_filter' ...


0

The excerpt automatically redirects to the single post page when clicked. I think the trouble you are having is is that [...] is not clickable, and you want to make it clickable. To do this you need to replace [...] with a custom Read More... link. You need to do something like this: function new_excerpt_more( $more ) { return ' <a ...


2

The are two quick ways to display custom excerpt lengths in your theme using wp_trim_words. Remember, if you use the_excerpt(), your excerpt length will always be a maximum of 55, never more. If you use the_content() on the other hand, you can specify an excerpt length of more than 55 words. Use the following to display your excerpt. Remember to replace ...


1

This is the function I use for controlling excerpt/content lengths, especially in situations where the end user won't likely remember to add the <!--more--> tag, but the design of the theme requires is. function excerpt($limit) { $excerpt = explode(' ', get_the_excerpt(), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); ...


1

I haven't tried the Gravity Forms plugin but if you are using the wp_insert_post function to insert the new post, you just use 'post_excerpt'. example: $new_post = array( 'post_title' => 'Post Title', 'post_content' => 'Post Content', 'post_status' => 'publish', 'post_excerpt' => $custom_excerpt_field ); ...



Top 50 recent answers are included