Way to show content of a post, but if exceeds character limit revert to excerpt?

replace the_content(); with echo wpse_limit_content(); function wpse_limit_content() { $content = $post->post_content; $MAX_LENGTH = 100; if ( strlen( $content ) <= $MAX_LENGTH ) return apply_filters(‘the_content’, $content ); $s2 = substr( $content, 0, $MAX_LENGTH ); $s3 = preg_split( “/\s+(?=\S*+$)/”, $s2 ); $s4 = $s3[0]; return apply_filters( ‘the_excerpt’, $s4 ); } If the string is to long it … Read more

WordPress excerpt for specific posts in category

Modify the callback and check the post category: function excerpt_read_more_link( $output ) { global $post; if ( in_category( ‘news’, $post ) ) return $output . ‘<a href=”‘. get_permalink( $post->ID ) . ‘”>more</a>’; return $output; } And you should prefix the function name. In its current form it is not safe enough.

how to use the_excerpt for two post queries?

function excerpt($limit) { $excerpt = explode(‘ ‘, get_the_excerpt(), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); $excerpt = implode(” “,$excerpt).’…’; } else { $excerpt = implode(” “,$excerpt); } $excerpt = preg_replace(‘`\[[^\]]*\]`’,”,$excerpt); return $excerpt; } write below code in your template. <?php echo excerpt(25); ?>

multiple excerpt length and styles

Are you aware of the uses of the More Tag? Customizing the Read More shows many uses of variable length teasers with variable link phrases to read more. For example, this markup entered in the Post editor will provide a link with Read the rest of this story in the anchor text. <!–more Read the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)