Hi,
The documentation of SkinTemplateNavigation and https://www.mediawiki.org/wiki/Manual:FAQ#How_do_I_add/remove_tabs_throughout_my_wiki?
doesn’t tell how to add a new tab after the talk page. I completely new to PHP, how to do so ?
Thank you
Add new header tab


The ‘Page’ and ‘Discussion’ tabs are called the ‘namespace’ links. You can modify them via the SkinTemplateNavigation hook. Something like the following in your LocalSettings.php should do it:
$wgHooks['SkinTemplateNavigation'][] = function( &$skin, &$links) {
$links['namespaces']['foobar'] = array(
'text' => 'Foo',
'href' => 'http://example.com/bar',
);
return true;
};

I would like a tab that works like to talk page:
If I’m on page A, I want to the the tabs: A; Talk (that redirects to Talk:A) and Code (that redirects to Code:A).
This tab redirects to a specific page

In that case, you can construct the URL based on the current title. Something like this:
$wgHooks['SkinTemplateNavigation'][] = function( SkinTemplate &$skin, &$links ) {
$code = Title::newFromText( 'Code:' . $skin->getTitle()->getText() );
$links['namespaces']['foobar'] = array(
'text' => 'Code',
'href' => $code->getInternalURL(),
);
return true;
};

Way better but still not perfect, as it appears on all namespaces (and I would only like it on Main and Main talk) and I would like pages in code namespace to have a tab to the main namespace’s page. See any en.Wikinews article where the main namespace has a Collaboration and a Comments page linked that way (it has been made in javascript).

For now I made two tabs so I can access the Code:[page] from [page] and vice versa (See the result) but I don’t know how to do a true namespace relation (Like the tabs of en.wn), or at least make one tab appear only while on certain namespace.