0

Is there a way I can add <a href="<?php the_permalink() ?>" rel="bookmark" title="Read more at: <?php the_title(); ?>"><?php the_title(); ?></a> in the excerpt manually?

1

Any PHP code in the post content will get stripped out and not executed. This is a safety issue; you don't want to allow authors to put in executable code.

To display code in a post, BTW, you would surround it with the <code> tag,

If you want to modify what the excerpt displays, you can use the get_the_excerpt filter, similar to this:

function filter_function_name( $excerpt ) {
  $excerpt .= "Thanks!";
}
add_filter( 'get_the_excerpt', 'filter_function_name' );

Which will add the word "Thanks!" after the excerpt. More examples in the codex here: https://codex.wordpress.org/Plugin_API/Filter_Reference/get_the_excerpt .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.