Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
697 views
in Q2A Core by
Related to the previous question...

what function (if any) I can add to header to have a description with the first words of the question (not title).

btw, thanks for your support.
related to an answer for: How to add a description?

1 Answer

+1 vote
by
edited by
You should make your own theme following the instructions here:

http://www.question2answer.org/advanced.php#theme-advanced

Your qa-theme.php file should override the head_custom() function, to include the question content in the header. The example below would include the whole question content:

<?php

    class qa_html_theme extends qa_html_theme_base
    {
        function head_custom()
        {
            if ($this->template=='question')
                $this->output('<META NAME="Description" CONTENT="'.strip_tags(@$this->content['q_view']['content']).'">');
        }
    }

?>

If you want to just get the first few words, you can use qa_string_to_words() in qa-util-string.php, then array_slice() to get the first few words, then implode() to concatenate them back into the original string.
...