user1635398
user1635398

Reputation: 31

How to add custom tab button with external link?

Using Mediawiki 1.19 and want to add tabs with external links right next to the tab buttons 'Page' and 'Discussion'. How to do it?

Upvotes: 3

Views: 1188

Answers (1)

Christian
Christian

Reputation: 1840

The code in the FAQ was outdated. For newer versions of MediaWiki, you have to use the SkinTemplateNavigation hook instead of the SkinTemplateContentActions hook. I updated the FAQ. Basically, you need to do something like this:

$wgHooks['SkinTemplateNavigation'][] = 'replaceTabs';
function replaceTabs( $skin, &$links) {  
        $links['namespaces']['name_of_tab'] = array(
                'class' => false or 'selected', // if the tab should be highlighted
                'text' => 'text_of_tab', // what the tab says
                'href' => 'url_to_point_to', // where it links to
                'context' => 'main',
        );
        return true;
}

Upvotes: 2

Related Questions