In Progress

20070612 Wordpress automatic linking plugin

This plugin is designed to automatically create hyperlinks within posts.

Before display of a post the text is searched and hyperlinks inserted if:

1. The full title of another post is used, in which case the link is to that post

2. The name of a link is used, in which case the link goes to wherever that link goes

The plugin will not change existing hyperlinks in a post or edit any text which already has html markup.

There should be a configuration option for how many times to hyperlink a term, e.g. 1= only the first, 2= first two and 999= all.

There should be a configuration option to have a TARGET field in the A tag. Configured separately for links to posts and links to links. e.g. I can have link to posts with no target field, but links to links with "_new"

If there are two possible matches, or titles are overlapping e.g. one is a substring of the other, then the long one takes precedence.

When there is a partial word match then the whole word should be hyperlinked.

Automatic linking must not make a page point to itself. If the title of the current post occurs in the text then it should link to a link of that name if one exists. Otherwise no link is required.

The posts are hyperlinked during output, the original text in the database is not changed.

Must work with wordpress 2.2 AND 1.5.2. You may need to code them separately.


Post #1:

Title: "Apple"

Text: "I think fruit is great. It is clear that fruit are good for you."

Post #2:

Title: "Fruit"

Text: "There are many fruit including apple and orange"

Post #3:

Title: "Fruit are good for you"

Text: "Because they contain many nutrients. This is particularly true of apples."

Link: #1:

Title: "Fruit"

Url: [url removed, login to view]

Link: #2:

Title: "Orange"

Url: [url removed, login to view]


Post #1:

Output text: "I think [fruit](hyperlinked to Post#2) is great. It is clear that [fruit are good for you](Hyperlinked to post #3)."

(Note that long phrase was linked first, then short phrase)

Post #2:

Output text: "There are many [fruit](hyperlinked to [url removed, login to view]) including [apple](hyperlinked to post #1) and [orange](hyperlinked to [url removed, login to view])"

(note that because this post is called "orange" the word orange does not link to itself, but instead links to the external link)

Post #3:

Output text: "Because they contain many nutrients. This is particularly true of [apples](hyperlinked to Post#1)."

(Note that the post #1 is called "apple" without S, but the text contains "appleS" plural. However the whole word apples has been linked to the post about apple)

Note there is already an plugin for wordpress (WP Automatic Reference [url removed, login to view]) that does some of this, but not all, and it doesn't work with current versions of wordpress.

Project must be completed within one week of acceptance.

技能: PHP

查看更多: wordpress automatic hyperlink, www wordpress, www linked, www clear com, word reference com, wordpress wp, wordpress s, wordpress e com, text markup, s wordpress, substring in c, substring c, substring 0 2, html 5 hyperlink, database one word or two, c substring, code 999, post linking, linking link phrase plugin, automatic reference wordpress

( 34个评论 ) Cheung Chau, Hong Kong

项目ID: #151512