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?
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 Answer
Reset to default 1Any 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/Plugin_API/Filter_Reference/get_the_excerpt .