Un motore di ricerca WordPress per sviluppatori e autori di temi



permalink_anchor ›

Da0.71
Deprecaton/a
permalink_anchor ( $mode = 'id' )
Parametri:
  • (string) $mode Optional. Permalink mode. Accepts 'title' or 'id'. Default 'id'.
    Richiesto: No
    Default: 'id'
Definito a:
Codex:

Displays the permalink anchor for the current post.

The permalink mode title will use the post title for the 'a' element 'id' attribute. The id mode uses 'post-' with the post ID for the 'id' attribute.



Sorgenti

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;
	}
}