Usage instructions
Introduction
Once it’s enabled, this plugin is fully transparent. All you need to keep in mind is that you must write valid XHTML. WordPress AutoLink will let you know if you’re not, with a warning above the post editor (which only pops up if you’re using the simple post editor, because the rich editor tends to generate valid XHTML).
When writing a post or page, WordPress AutoLink will transparently:
- replace hyperlinks (
http://your-blog-address/...or/archives/.../a-post-slug/) pointing to posts or pages withpost:post-nameshortcuts, using the target post name as reference - replace references to files in your WordPress uploads directory (
http://your-blog-address/wp-content/uploads/...) withcontent:/path/to...shortcuts, in HTML attributes likehreforsrc, or within JavaScriptonblur,onfocus,onclick,onmouseoverandonmouseoutevents
You won’t notice this at all when you’re at the editor, since WordPress AutoLink reverses its actions for the editor (whether it’s the rich editor or the simple one) — which means that you will always see the right content in your post editor (whether it’s images or posts).
When showing a post to a reader, WordPress AutoLink dynamically reverses these actions.
- It places the right permalink for each
post:reference. - It adds a
title="..."attribute to each relativized hyperlink, stating the post or page title. - It places the right hyperlink to files in your upload directory.
- It adds a
rel="lightbox"attribute for each thumbnail image that is hyperlinked to a full-size image.
More specifically, any inserted image whose immediate parent is a hyperlink to another image will go through this treatment.
Processing your existing content
To replace hyperlinks and references to files with shortcuts, you could edit page after page, saving each one in turn. Or you could use the Process all posts and pages tool.
To access the Process all posts and pages tool, open your WordPress administration console, and click the Manage tab. Once the Manage screen appears, click the AutoLink tab on the secondary strip. You’ll be presented with a screen that looks like this:
Follow the instructions onscreen.
Once you’re done, you can be pretty certain that you’ll never have a broken hyperlink or image again. Well, at least not hyperlinks pointing to content within your blog.
Note that the Process all posts and pages tool will ignore posts or pages that you don’t have permission to edit.
Manually specifying links
You can, of course, specify links manually, to save time and avoid typing lengthy hyperlinks or copying and pasting.
Using shortcuts to link to pages or posts
When editing an article, you can specify hyperlinks in several ways:
<a href="post:848">creates a permalink to your post or page with ID 848<a href="post:a-long-article">creates a permalink to your post or page with namea-long-article
Remember that the title attribute is automatically filled in for you, with the title of the article, but only if you do not specify it. If you specify it, yours will take precedence.
Using shortcuts for images and other types of file
<a href="content:afile.zip">creates a permalink tohttp://yourblog.com/wp-content/uploads/afile.zip(assuming your blog is located atyourblog.comand the uploads directory ishttp://yourblog.com/wp-content/uploads/<img src="content:mypicture.jpg">inserts an image fromhttp://yourblog.com/wp-content/uploads/mypicture.jpg(assuming your blog is located atyourblog.comand the content directory ishttp://yourblog.com/wp-content/uploads/
For JavaScript embedded events
This plugin also supports the JavaScript onblur, onfocus, onclick, onmouseover and onmouseout events, so you can have a JavaScript string beginning with content: be automatically replaced by the proper URL. The post: shortcut is not supported.
Overriding the automatic `rel=”lightbox”` insertion
Simple. If you have an image which hyperlinks to another image, but you don’t want Lightbox to kick in, simply add a rel="link" attribute to the hyperlink (<a href="..." rel="link"...).
Notes
WordPress AutoLink will skip treatment of posts that contain invalid or malformed XHTML (overlapping tags, unclosed tags, unknown entity references). This has a reason: WordPress AutoLink internally uses a DOM processor (to guarantee repeatable and high-quality results). The DOM processor cannot parse non-XML text (which includes malformed or invalid markup).
References to files that don’t start with your full uploads address (http://...) won’t be turned into content: references.
To see a list of compatible and incompatible plugins and software for WordPress, please refer to the compatibility guide.