admin管理员组文章数量:1431272
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 .
本文标签: PHP Code in excerpt
版权声明:本文标题:PHP Code in excerpt? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745571985a2664099.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论