Custom search results page not showing excerpt
Custom search results page not showing excerpt
Custom search results page not showing excerpt
1) Follow this post on Stackoverflow or the link given by @PieterGoosen. 2) You can also use get_the_content() instead of get_the_excerpt()
2 posts same excerpt?
Would the has_excerpt() function work? The Codex says of it: Whether the current post has an excerpt.
Search & Replace trailing strings
It happens because using explode() to parse HTML is at least equally evil as trying to do it with regex. To “fix” it, the quick ’n dirty way, you could add the following preg_replace() after the implode() line: $wpse0001_excerpt = implode( ‘</p>’, $tmp_to_add ).'</p>’; $wpse0001_excerpt = preg_replace( ‘/<\/p>\s*<\/p>/’, ‘</p>’, $wpse0001_excerpt ); Using something like PHP’s … Read more
As said in my edit to my answer to your previous post, I have rewritten your complete shortcode to be a bit more useful, and I also removed the extract() function which is a bad function to use. To answer this question, I had to further modify your shortcode. To avoid clash with other excerpt … Read more
function get_custom_excerpt( $content, $link ){ $content = some_function_to_handle_html_tag(substr($content, 0, 100)); // EDIT: need to be customized with a regex for proper output $content .= ‘ <a href=”‘.$link.'”> more… </a>’; return $content; } function some_function_to_handle_html_tag(){ //a regex to check last occurance of html opening tag //append respective closing tag or strip the tag if broken e.g. … Read more
is_page_template() doesn’t work with excerpt_length filter
Try this one , .. $ID = get_the_ID(); $page_data = get_page( $ID ); $excerp = strip_tags($page_data->post_excerpt); if ( !empty( $excerp ) ) : the_excerpt(); else : echo get_permalink() endif;