how to get excerpt without p html tag from wordpress post
Please add below code in theme functions.php remove_filter( ‘the_excerpt’, ‘wpautop’ );
Please add below code in theme functions.php remove_filter( ‘the_excerpt’, ‘wpautop’ );
general: locate the template for the home page – often index.php – if not see http://codex.wordpress.org/Template_Hierarchy find the_content() (possibly with some parameters in the brackets) and change that to the_excerpt() – http://codex.wordpress.org/Function_Reference/the_excerpt specific for Twenty Eleven: index.php points to the template part content.php; in content.php edit this line: <?php if ( is_search() ) : // … Read more
Put a filter on the_content_more_link. Untested but… function wrap_more_link($more) { return ‘<div>’.$more.'</div>’; } add_filter(‘the_content_more_link’,’wrap_more_link’);
You may try the following code. $content = get_the_excerpt(); $content = preg_replace(“/<img(.*?)>/si”, “”, $content); echo $content; preg_replace will remove the image tag content from the post content.
There’s a discussion on WP Support Forum that was related to your question. The pastebin constains the function stated in the other answer. I’ve decreased the priority to 5 and it works on my test theme. add_filter( ‘get_the_excerpt’, ‘wp_strip_header_tags’, 5); If you want to target only <h3> you can use this regex: $regex = ‘#(<h([3])[^>]*>)\s?(.*)?\s?(<\/h\2>)#’;
I too am looking for this option / feature. I came across this guys explanation which I believe answers most of the question. I am in the process of implementing this so I cannot say how accurate it is being a wordpress noob (not php!), I do realise this is for a custom box but … Read more
I’m not quite clear if your saying you can call the excerpt but it’s not showing up or if you don’t know the function to show the excerpt. If it’s the former it might be a CSS issue, if the latter the following should do the trick: <div class=”content-summary”> <?php the_excerpt(); ?> </div> You can … Read more
The top answer to this question handles dynamically altering the length of your excerpt using a custom excerpt function.
Show excerpts of posts on P2 Home page
Excerpt content