Extension:PlaceNewSection

What can this extension do?
This extension introduces two magic words, __ADDNEWSECTIONBELOW__ and __ADDNEWSECTIONABOVE__ that control placement of new talk page sections.

Usage
If __ADDNEWSECTIONBELOW__ is placed on a page, new sections will be added directly below it instead of after the end. Newer sections will be at the top, and older sections at the bottom.

If __ADDNEWSECTIONABOVE__ is used, new sections will be added directly above it, and the order will be reversed (new sections at the bottom, like the MediaWiki default), but anything below this magic word will stay at the bottom.

Mediawiki 1.35+
Download the files of the next repository of github: https://github.com/ernstki/mediawiki-extensions-PlaceNewSection

After of the download the files, add the next code to Localsenttigs.php:

MediaWiki 1.19
MediaWiki 1.19 does not need to be patched; it already has the PlaceNewSection hook.

Older versions
This extension requires a modification to Article.php in MediaWiki <= 1.17 and WikiPage.php in MediaWiki 1.18 (these files are in the  directory).

Find the  function and this code:

then change it to:

After that cut and paste the code found below and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php: