Cross-references WordPress Plugin
With this plugin you can easily insert hyperlinked cross-references between posts or pages in your
WordPress blog. You can also automatically get all the back references for each post or page.
Installation
1. Download the .zip file and unzip it
2. Upload crossreferences.php to the /wp-content/plugins/ directory
3. Activate the plugin through the 'Plugins' menu in WordPress
4. Place <?php the_crossreferences(); ?> in your templates where you want to get the back links
Usage basics
Forward links. When writing your posts, you can refer to other posts by their ID number, like so: [cref 12]. This is shown at the blog as the title of post #12 with a link to it.
Back links. To show a list of all the posts that link to the current post, put <?php the_crossreferences() ?> in your template. For example at the page single.php of your current theme you can write:
<h2>Related posts</h2><?php the_crossreferences() ?>
If you change the title of a post it will automatically update when linked from other posts.
If you remove a post the links to it will automatically remove (the post content remains unchanged).
Forward and back links can be used at any post und page in the blog.
Usage details
If you want to get another description instead of the post title, write it after the id: [cref 12 see above]. This is shown at the blog as "see above" with a link to post #12.
If you write [cref.from 12] you do not see a forward link, but both posts get linked to each other as a back link (appear at the "related posts" list).
The parameters from template function are the_crossreferences( $before, $between, $after, $id).
$before - Optional. This string being printed once before the related posts list (only if there is 1 related post or more)
$between - Optional. This string being printed between 2 entries in the related posts list.
$after - Optional. This string being printed once after the related posts list (only if there is 1 related post or more)
$id - Optional. The post id number to which the related posts list are shown.
Examples:
If you write <?php the_crossreferences() ?> you get an output such as:
<li>Post title 1</li><li>Post title 2</li><li>Post title 3</li> (if there are 3 related posts)
Nothing (if there are no related posts)
If you write <?php the_crossreferences('See also:', '; ', '.') ?> you get an output such as:
See also: Post title 1; Post title 2; Post title 3.(if there are 3 related posts)
Nothing (if there are no related posts)
If you write <?php the_crossreferences('<h2>Related posts</h2><li>') ?> you get an output such as:
<h2>Related posts</h2><li>Post title 1</li><li>Post title 2</li> (if there are 2 related posts)
Nothing (if there are no related posts)
If you write <h2>Related posts</h2><?php the_crossreferences() ?> you get an output such as:
<h2>Related posts</h2><li>Post title 1</li><li>Post title 2</li> (if there are 2 related posts)
<h2>Related posts</h2> (if there are no related posts)
License
This plugin is free software licensed under the
GNU General Public License.