Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
in Q2A Core by

I would like to add a tab next to "questions" ,"unanswered", "tags", "users" and "ask a question". This tab would be a link to my website.

1 Answer

0 votes
There are several ways to do this, but the safest one is to create a new advanced theme following the instructions here:


In your theme's qa-theme.php file, override the nav_list() method to insert the link:


    class qa_html_theme extends qa_html_theme_base
        function nav_list($navigation, $navtype)
            if ($navtype=='main')
                $navigation['custom']=array( 'url' => 'http://your-page/', 'label' => 'your-label');
            qa_html_theme_base::nav_list($navigation, $navtype);

It's planned to make this much easier to do in future, via the admin interface.
how would you move it before the ask a question button, or possibly move the admin button all the way to the right?
If you want to add a mouse-over text using the "title-tag" unfortunately you had to modify the main-source:


add in the function nav_link(...)  the line  
(isset($navlink['title']) ? (' Title="'.$navlink['title'].'"') : '').

the whole function will look like this:

function nav_link($navlink, $navtype)
            if (isset($navlink['url']))
                    '<A HREF="'.$navlink['url'].'" CLASS="qa-nav-'.$navtype.'-link'.
                    (@$navlink['selected'] ? (' qa-nav-'.$navtype.'-selected') : '').'"'.
                    (isset($navlink['target']) ? (' TARGET="'.$navlink['target'].'"') : '').
                    (isset($navlink['title']) ? (' Title="'.$navlink['title'].'"') : '').
                    (strlen(@$navlink['note']) ? (' ('.$navlink['note'].')') : '')

and in the file qa-theme.php  use this line:
if ($navtype=='main')
$navigation['custom']=array( 'url' => 'http://your-page/', 'label' => 'your-label', 'title' => 'mouse-over text...');

hopefuly this addon will be added in future versions of q2a?