Codex tools: Log in / create account
Contents |
Returns the permalink to a post for use in PHP. It does NOT display the permalink and can be used outside of The Loop.
<?php get_permalink(id); ?>
The permalink for current post (used within The Loop). As the tag does not display the permalink, the example uses the PHP echo command.
Permalink for this post:<br /> <?php echo get_permalink(); ?>
Returns the permalinks of two specific posts (post IDs 1 and 10) as hypertext links within an informational list. As above, tag uses the PHP echo command to display the permalink.
<ul>
<li>MyBlog info:
<ul>
<li><a href="<?php echo get_permalink(1); ?>">About MyBlog</a></li>
<li><a href="<?php echo get_permalink(10); ?>">About the owner</a></li>
</ul>
</li>
</ul>
permalink_anchor, get_permalink, the_permalink, permalink_single_rss