• Register
Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

how to automatically link certain words to specified pages

0 votes
134 views
I would like to automatically link certain words in the text of asked questions and the answers to specified pages.

I would think this perhaps requires a plugin which allows to specify the words and the connected pages and the maximum number of links per keyword within each page to be specified as well.

So for example if the word 'estimated crazy things' shows up the plugin automatically links it to http://www.yourdomain.com/estimated-crazy-things.html

It this word combination (estimated crazy things) shows up 7 times, I would have to be able to set the links to a limit of 2 per page, which then will be placed at random.

The plugin would also have to be able to deal with capitalised version of the keyword combination.

Anybody have any ideas how to go about this?
asked Aug 17, 2011 in Q2A Core by OllieJames

2 Answers

0 votes
You could do this with a layer (part of a plugin) which processes the HTML rendered content of posts, adding in the links to that HTML.
answered Aug 17, 2011 by gidgreen
Thanks Gideon,

Could you give me an example how to do this code wise?

shalom!
0 votes

You could start with the embed plugin:

https://github.com/NoahY/q2a-embed

and just hard code the substitutions, or adapt it for database retrieval.  You could even just use qa_opts to save the substitutions, that'd be a quick albiet dirty way.

answered Aug 18, 2011 by NoahY
Thanks NoahY,

Tried that but can not get this to work. Could you give one example of a hard coded substitution?

ANd how would I limit the number of substitutions on each page?

thanks again.

Ollie
...