Definition:
function permalink_anchor($mode = 'id') {}
Display permalink anchor for 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.
Parameters
- string $mode: Permalink mode can be either ‘title’, ‘id’, or default, which is ‘id’.
Source code
function permalink_anchor($mode = 'id') {
global $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;
}
}
2501

February 12, 2011 


No comments yet... Be the first to leave a reply!