## php – How to put “Read more” link in Custom Excerpt inside p tag?

Question

I have a piece of code that extracts the first paragraph from the post, enclosed in a p tag.

I want to add a “Read more” link inside the p tag referring to “the full post“.

function first_paragraph() {
global $post,$posts;
$first_para=""; ob_start(); ob_end_clean();$post_content = $post->post_content;$post_content = apply_filters('the_content', $post_content);$output = preg_match_all('%(<p[^>]*>.*?</p>)%i', $post_content,$matches);
$first_para =$matches [1] [0];