user586011
user586011

Reputation: 1968

How do I remove the footer in MediaWiki?

I am trying to remove the footer in my MediaWiki installation

I am using the Vector theme.

The instructions on the MediaWiki site don't seem to match the Vector theme, which appears to be the default one.

I can't find any of the $wg elements mentioned on the MediaWiki site (such as $wgHooks and $wgMaxCredits) in the Vector theme itself. So how can I modify the theme to remove the footer elements?

Any help or advice would be much appreciated. I am sure I am missing some part of the MediaWiki site, but can't seem to find it.

Upvotes: 4

Views: 4279

Answers (2)

ByteSlinger
ByteSlinger

Reputation: 1597

You can use CSS to remove the footer for any theme or skin: there is a common CSS file built into the MediaWiki database behind each wiki:

http://<your-site>/wiki/index.php/MediaWiki:Common.css

Enter that link in your browser to go that page. Then click the "Edit" link to edit that page and add this line to the page:

#footer { display: none; }

NOTE: You may not want to remove the entire footer. You can remove individual components by entering them in the WikiMedia:Common.css instead:

/* last modification stuff */
#footer-info { display: none; }

/* footer links */
#footer-places { display: none; }

/* powered by icon */
#footer-icon { display: none; }

Personally, I would keep the footer-icon which contains the Powered by MediaWiki icon, and give credit where it is due.

If you are working with the MobileFrontend extension then you will also need to add the same lines to:

http://<your-site>/wiki/index.php/MediaWiki:Mobile.css

Do you want to remove the WikiMedia footer or just change it?

I can see wanting to remove parts of the default footer like the last modification string. You can use CSS to hide it as I mentioned above or you can enter this URL into your browser:

http://<your-site>/wiki/index.php/MediaWiki:Lastmodifiedat

Edit that page and remove the line that's there, then save the page. The last modification stuff will disappear from your wiki pages.

But the footer links section can be very useful. If you want to CHANGE the footer links, there is a hook (SkinTemplateOutputPageBeforeExec) provided in the MediaWiki docs:

https://www.mediawiki.org/wiki/Manual%3AFooter#Add_links_to_the_footer

If you want to REMOVE the existing footer links and ADD YOUR OWN new footer links, follow the instructions in the embedded comments and then add this PHP code to your LocalSettings.php file:

# Remove all existing footer links and add my own
$wgHooks['SkinTemplateOutputPageBeforeExec'][] = function( $sk, &$tpl ) {

        # IMPORTANT:  this is the secret sauce - remove all existing footer links
        $tpl->data['footerlinks']['places'] = array();

        # To add new footer links to local wiki pages:
        #
        # 1) You MUST create your new pages in your (Main) namespace first, for example:
        #
        #       http://<your-site>/wiki/index.php/About_Us
        #       http://<your-site>/wiki/index.php/Contact_Us
        #       http://<your-site>/wiki/index.php/Disclaimer
        #       http://<your-site>/wiki/index.php/Download
        #       http://<your-site>/wiki/index.php/Privacy_Policy
        #
        # 2) You MUST then create each of these pages in your MediaWiki namespace:
        #
        #       http://<your-site>/wiki/index.php/MediaWiki:Aboutpage 
        #               - Insert 1 line, with "About Us" (no quotes)
        #       http://<your-site>/wiki/index.php/MediaWiki:Contactpage 
        #               - Insert 1 line, with "Contact Us" (no quotes)
        #       http://<your-site>/wiki/index.php/MediaWiki:Disclaimerpage 
        #               - Insert 1 line, with "Disclaimer" (no quotes)
        #       http://<your-site>/wiki/index.php/MediaWiki:Downloadpage 
        #               - Insert 1 line, with "Download" (no quotes)
        #       http://<your-site>/wiki/index.php/MediaWiki:Privacypage 
        #               - Insert 1 line, with "Privacy Policy" (no quotes)
        #
        # 3) Add new footer links like this:

        $tpl->set( 'aboutpage', $sk->footerLink( 'aboutpage', 'aboutpage' ) );
        $tpl->data['footerlinks']['places'][] = 'aboutpage';
        $tpl->set( 'contactpage', $sk->footerLink( 'contactpage', 'contactpage' ) );
        $tpl->data['footerlinks']['places'][] = 'contactpage';
        $tpl->set( 'disclaimerpage', $sk->footerLink( 'disclaimerpage', 'disclaimerpage' ) );
        $tpl->data['footerlinks']['places'][] = 'disclaimerpage';
        $tpl->set( 'downloadpage', $sk->footerLink( 'downloadpage', 'downloadpage' ) );
        $tpl->data['footerlinks']['places'][] = 'downloadpage';
        $tpl->set( 'privacypage', $sk->footerLink( 'privacypage', 'privacypage' ) );
        $tpl->data['footerlinks']['places'][] = 'privacypage';

        return true;
};

IMPORTANT: Don't forget to follow the instructions and create your own pages and the corresponding MediaWiki redirects, or your links may not show or they may be broken.

Upvotes: 3

Florian
Florian

Reputation: 2874

I'm not sure why you want to do that, but here are some thoughts:

The "This page was last modified..." message is constructed with the Lastmodifiedat interface message. So, if you edit MediaWiki:Lastmodifiedat in your wiki and remove any contents, the footer element will be empty (even if the li-element is still there!).

The number of views was removed in MediaWiki 1.25, so i suggest you upgrade your wiki and the count will be away automatically ;) If you don't want to upgrade or can't (for whatever reason) you can set $wgDisableCounters = false; in your LocalSettings.php.

The privacy, about and disclaimer link can be removed by replacing the appropriate interface messages with a dash "-". Just edit these pages on your wiki:

  • MediaWiki:Privacy
  • MediaWiki:Aboutsite
  • MediaWiki:Disclaimers

To remove the MediaWiki image, you just need to set this line in your LocalSettings.php: $wgFooterIcons['poweredby'] = array();

Btw.: You don't see most of the variables and interface messages in the Vector skin, because the footer is mostly generated in MediaWiki itself and the Skin simply handels how it is displayed, not what is displayed.

Upvotes: 6

Related Questions