Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
637 views
in Q2A Core by
related to an answer for: How can we add one more tab?

1 Answer

+3 votes
by
To add 2 tabs, use this sort of code in your theme's qa-theme.php file:

<?php

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

As for reordering, you would need to rebuild the array from scratch in the right order, so the final code would be something like this:

<?php

    class qa_html_theme extends qa_html_theme_base
    {
        function nav_list($navigation, $navtype)
        {
            if ($navtype=='main') {
                $oldnavigation=$navigation;

                // add the first ones in explicit order
                $navigation['questions']=$oldnavigation['questions'];
                $navigation['custom_1']=array( 'url' => 'http://your-page/', 'label' => 'your-label');
                $navigation['tag']=$oldnavigation['tag'];
                $navigation['custom_2']=array( 'url' => 'http://your-other-page/', 'label' => 'your-other-label');

                // add on any remaining ones
                foreach ($oldnavigation as $key => $navlink)
                    if (!isset($navigation[$key]))
                        $navigation[$key]=$oldnavigation[$key];
            }
            
            qa_html_theme_base::nav_list($navigation, $navtype);
        }
    }
    
?>
...