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

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
by
There are several ways to do this, but the safest one is to create a new advanced theme following the instructions here:

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

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

<?php

    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.
by
how would you move it before the ask a question button, or possibly move the admin button all the way to the right?
by
If you want to add a mouse-over text using the "title-tag" unfortunately you had to modify the main-source:

..\qa-include\qa-theme-base.php

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']))
                $this->output(
                    '<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'].'"') : '').
                    '>'.$navlink['label'].
                   
                    '</A>'.
                    (strlen(@$navlink['note']) ? (' ('.$navlink['note'].')') : '')
                );
            else
                $this->output($navlink['label']);
        }

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?
...