Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.0k views
in Q2A Core by
How can I add a hyperlink of a keyword in a question?

I want to be able to edit a question and hyperlink a specific phrase or keyword to another part of my site... thanks

2 Answers

0 votes
by
currently this feature is not available in question2answer. It might come in future release.
0 votes
by
As ProThoughts says this is not in Q2A right now. However, it is possible using an advanced theme. I'm assuming you know a little PHP for this.

First follow the instructions on http://www.question2answer.org/advanced.php to make an "advanced theme".

Then you will need to override the function that outputs the question and answer content and use a regular expression to replace the word with your linked version. You might get away with a simple string replace:
    str_replace( ' keyword ', ' <a href="example.com">keyword</a> ', $string );
by
I tried this:
function main_parts($content)
        {
            foreach ($content as $key => $part) {
                if (strpos($key, 'custom')===0)
                    $this->output_raw($part);
                                       
                elseif (strpos($key, 'form')===0)
                    $this->form($part);
                   
                elseif (strpos($key, 'q_list')===0)
                    $this->q_list_and_form($part);

                elseif (strpos($key, 'q_view')===0)
                    $this->q_view($part);
                   
                elseif (strpos($key, 'a_list')===0)
                    $this->a_list($part);
                   
                elseif (strpos($key, 'ranking')===0)
                    $this->ranking($part);
            }
            {
                $this->str_replace( ' key word ', ' <a href="http://www.example.com">key word</a> ', $string );
            }
        }

But that does not do anything, any ideas?
...