Template Tags / post_link()

Note
This function replaces linkToPost() (which may still be used, though will be removed in future versions. It is advised that you update your theme templates to make use of post_link() instead.

Description

This function creates a URL that can be used in an <a> tag. It is automatically adjusted based on the clean URLs option.

Usage

<?php echo post_link( $id ); ?>

Parameters

$id

  • integer or string
  • optional

The ID number or slug of the post to link to. Defaults to currently selected project.

Examples

Usage in blog_list.html

<a href="<?php echo post_link(); ?>"><?php echo postTitle(); ?></a>

Link to a specific project

<a href="<?php echo post_link( 'project-slug' ); ?>">Take a look!</a>