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.

Remove read more

It sounds like your theme is using the_excerpt() instead of the_content() when displaying the post. If you want to display the full post you’ll need to edit your index.php file to use the_content() instead.

Add read more to the_content

You could add a link manually like: <a href=”https://wordpress.stackexchange.com/questions/88976/<?php echo get_permalink($post->ID) ?>”>Read More…</a> If you want to add the link at the end of the content you could do: return implode(‘ ‘, array_slice($words, 0, $word_limit)) . ‘<a href=”‘.get_permalink($post->ID).'”>Read More…</a>’;

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