Using a shortcode, you can create a link to another post, page, tag, or category. You use the ID number or the slug to identify what you are linking to. The link will automatically use the title of the post, page, tag, or category as the link text, or you can supply your own link text.
It makes linking within your site more convenient, and it means your links won’t break if you ever change your permalink structure or change the parent-child relationships of your categories.
If you also install the Koumpounophobia plugin, you will get a Post-to-Post Links II button added to your HTML Editor. You can use that button to add the Post-to-Post Links II shortcode to your post. If you don’t have Koumpounophobia, or you’re using the Visual Editor, here are a couple examples of the shortcode:
[p2p type=”id” value=”53″]
[p2p type=”slug” value=”hello-world” text=”read my Hello World post” attributes=”target=’_blank'”]
Possible values for “type” are:
- slug: a post or page slug
- id: a post or page ID number
- cat_slug: a category slug
- cat_id: a category ID number
- tag_slug: a tag slug
- tag_id: a tag ID number
The “value” attribute is either the slug or ID number of the linked post, page, category, or tag.
The “text” attribute provides the text for the link. It’s optional – if you leave it out, the title of the post, page, tag, or category will be used.
“attributes” is optional, and allows you to provide any other attributes you’d like for the link, such as a target, title, onclick, etc. Note that you need to use single quotes here, since the value itself is delimited by double quotes.
This plugin is inspired by the “Post-to-Post Links” plugin written (but no longer maintained by) Scott Reilly. Unfortunately though, it cannot interpret the old tags. Post-to-Post Links II uses WordPress’ robust shortcode functionality, which is not compatible with the syntax Scott used in Easy Post-to-Post Links.
A .pot file is included for localization, and a Russian translation is included.
Free Download: Download this wp-plugin