Available from version 1.35.0
Occurs whenever a page is rendered and allows to add HTML after portlets have been put out.
Define function:
public static function onSkinAfterPortlet( $skin, $portletName, &$html ) { ... }
Attach hook: In extension.json:
	"Hooks": {
		"SkinAfterPortlet": "MyExtensionHooks::onSkinAfterPortlet"
Called from: File(s): skins/Skin.php
Interface: SkinAfterPortletHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:SkinAfterPortlet extensions.

After output of portlets, allow injecting custom HTML after the section. Any uses of the hook need to handle escaping. Note that if portlet is empty and $html is non empty, the portlet will be rendered.


  • $skin Skin
  • $portletName: string portlet name
  • &$html: string The HTML code to display. Will be wrapped into a div tag, but apart from that will be output into the page directly. Escape dangerous signs!


This example will place an ad in the sidebar following the Toolbox ("tb") portlet. Replace the data-ad-client and data-ad-slot with your own values.

$wgHooks['SkinAfterPortlet'][] = function($skin, $portletName, &$html) {
    $user = $skin->getUser();
    if ($user->isRegistered() && $portletName === "tb") {
        $html = <<< EOT
        <script async src="//"></script>
                <ins class="adsbygoogle"
                     style="display:inline-block;width:160px;height:1000px;margin:20px 0 0 -20px;"
                (adsbygoogle = window.adsbygoogle || []).push({});
        return true;