Post-to-Post Links

Post-to-Post Links

Wordpress plugin

Install on Wordpress

App Details

Easily create a link to another post using a shortcode to reference the post by id or slug; the link text is the post’s title, unless overridden.

When writing your posts, you can refer to other posts either by ID, like so:

[post2post id="20"] 

or by the post slug/name, like so:

[post2post id="hello-world"] 

When viewed on your site, the post-to-post link tag is replaced with a permalink to the post you’ve referenced. By default, the text of the link will be the referenced post’s title, resulting in something like:

"<a href="http://example.com/archives/2005/04/01/hello-world/" title="Hellow World!">Hello World!</a>" 

You can optionally customize the link text by specifying a text="" attribute and value to the post-to-post link tag:

Check out [post2post id="hello-world"]my first post[/post2post]. 

Which yields:

Check out "<a href="http://example.com/archives/2011/07/01/hello-world/" title="Hello World!">my first post</a>". 

The plugin provides its own admin options page via Settings -> Post2Post in the WordPress admin. Here you can define text that you want to appear before and/or after each post-to-post substitution, and if you want to enable legacy tag support. The plugin’s admin page also provides some documentation.

Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage

Examples

These are all valid ways to reference another of your posts on the same blog.

  • [post2post id="25"]
  • [post2post id="25"/]
  • `[post2post id=”the-best-post-ever”]
  • `[post2post id=”the-best-post-ever”/]

Assuming all of the above were used to reference the same post, the replacement for the post-to-post shortcut would be:

"<a href="http://example.com/2011/07/01/the-best-post-ever" title="The Best Post Ever!">The Best Post Ever!</a>" 

For any of the above you can also optionally wrap the shortcode around text. If so defined, that text will be used as the link text as opposed to the referenced post’s title.

  • [post2post id="25"]this post[/post2post]
  • [post2post id="blog-anniversary"]Congratulate me![/post2post]

The first of which would produce:

"<a href="http://example.com/2011/07/01/the-best-post-ever" title="The Best Post Ever!">this post</a>" 

You can also optionally definte the text that appears before and after the generated links. By default these are quotes.

  • `[post2post id=”25″ before=” ” after=”!”]

Yields:

 <a href="http://example.com/2011/07/01/the-best-post-ever" title="The Best Post Ever!">this post</a>!<h3>Legacy</h3> 

The legacy syntaxes — which are disabled by default and not recommended for use unless you’ve used version of the plugin earlier than v3.0 — allow you to refer to other posts by ID using a pseudo-shortcode syntax or an HTML comment syntax, like so:

[post="20"] or `<!--post="20"-->` 

or by the post slug/name, like so:

[post="hello-world"] or `<!--post="hello-world"-->.` 

The HTML comment notation was the original syntax employed by earlier versions of this plugin (pre v2.0). While it is still supported, it is no longer the primary and recommended syntax. The pseudo-shortcode syntax was in use between v2.0 and v3.0 of the plugin.

NOTE: The HTML comment syntax notation does NOT play well with the visual (aka rich-text) editor in the WordPress admin.

Examples of old legacy syntax follow. Those that use the pseudo-shortcode syntax (i.e. [post=25]) only work if you’ve checked “Enable legacy pseudo-shortcode tag support?”. Those that use HTML comment notation (i.e. <!-- post="XX" -->) only work if you’ve checked “Enable legacy HTML comment-style tag support?”.

  • [post=25]
  • [post="25"]
  • [post = "25"]
  • [post='25']
  • [post = '25']
  • [post="the-best-post-ever"]
  • [post = "the-best-post-ever"]
  • [post='the-best-post-ever']
  • [post = 'the-best-post-ever']
  • <!--post=25-->
  • <!-- post = 25 -->
  • <!--post="25"-->
  • <!--post = "25" -->
  • <!-- post='25'-->
  • <!-- post = '25' -->

NOTE: Only activate the legacy mode(s) that apply to your use of older versions of the plugin. If you started using the plugin at v3.0 or later, you should not activate either legacy mode.

Filters

The plugin exposes one filter for hooking. Typically, customizations utilizing this hook would be put into your active theme’s functions.php file, or used by another plugin.

c2c_post2post_shortcode (filter)

The ‘c2c_post2post_shortcode’ hook allows you to define an alternative to the default shortcode tag. By default the shortcode tag name used is ‘post2post’. It is recommended you only utilize this filter before making use of the plugin’s shortcode in posts and pages. If you change the shortcode tag name, then any existing shortcodes using an older name will no longer work (unless you employ further coding efforts).

Arguments:

  • $shortcode (string)

Example:

/** * Use a shorter shortcode: i.e. [p2p id="32"] * * @param string $shortcode The default shortcode name. * @return string The new shortcode name. */ function change_post2post_shortcde( $shortcode ) { return 'p2p'; } add_filter( 'c2c_post2post_shortcode', 'change_post2post_shortcde' ); 

Pricing

Starting from $0 per month.

Check Out the Podcast Player Widget

By Common Ninja

Podcast PlayerTry For Free!

App Info

Rating

Reviewers

No reviews

Tags

links
pages
post
posts
shortcode

Developed By

Scott Reilly

Quick & Easy

Find the Best Wordpress plugins for you

Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!

Testimonial

Testimonial plugins for Wordpress

Galleries

Galleries plugins for Wordpress

SEO

SEO plugins for Wordpress

Contact Form

Contact Form plugins for Wordpress

Forms

Forms plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Sliders

Sliders plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Comments

Comments plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Maps

Maps plugins for Wordpress

Security

Security plugins for Wordpress

Translation

Translation plugins for Wordpress

Ads

Ads plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Music Player

Music Player plugins for Wordpress

Backup

Backup plugins for Wordpress

Privacy

Privacy plugins for Wordpress

Optimize

Optimize plugins for Wordpress

Chat

Chat plugins for Wordpress

Countdown

Countdown plugins for Wordpress

Email Marketing

Email Marketing plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Membership

Membership plugins for Wordpress

popup

popup plugins for Wordpress

SiteMap

SiteMap plugins for Wordpress

Payment

Payment plugins for Wordpress

Coming Soon

Coming Soon plugins for Wordpress

Ecommerce

Ecommerce plugins for Wordpress

Customer Support

Customer Support plugins for Wordpress

Inventory

Inventory plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Testimonials

Testimonials plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Slider

Slider plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Membership

Membership plugins for Wordpress

Forms

Forms plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Contact

Contact plugins for Wordpress

Comments

Comments plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Common Ninja Apps

Some of the best Common Ninja plugins for Wordpress

Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.

Discover Apps By Platform

Discover the best apps for your website

WordPress
Wix
Shopify
Weebly
Webflow
Joomla
PrestaShop
Shift4Shop
WebsiteX5
MODX
Opencart
NopCommerce

Common Ninja Search Engine

The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!

Multiple platforms