permalink_anchor()
最后更新于:2021-11-27 18:45:03
permalink_anchor( string$mode=’id’)Displays the permalink anchor for the current post.
参数
- $mode
-
(string) (Optional) Permalink mode. Accepts ‘title’ or ‘id’.
Default value: ‘id’
源文件
文件: gc-includes/link-template.php
function permalink_anchor( $mode = 'id' ) {
$post = get_post();
switch ( strtolower( $mode ) ) {
case 'title':
$title = sanitize_title( $post->post_title ) . '-' . $post->ID;
echo '<a id="' . $title . '"></a>';
break;
case 'id':
default:
echo '<a id="post-' . $post->ID . '"></a>';
break;
}
}