If you are looking to overwrite the default index page on your Elgg install, then it is best to do this as a plugin in order to keep the upgrading of your Elgg install as pain free as possible.

The main Elgg index runs a plugin hook called ‘index,system’. If this returns true, it assumes that another front page has been drawn and doesn’t display the default page.

Therefore, you can override it by registering a function to the ‘index,system’ plugin hook and then returning true from that function. This means you can write exactly the front page you want without having to edit core Elgg. The Elgg community site runs on an untouched Elgg core altered through plugins, for example.)


  • 创建一个新插件
  • 在插件 start.php 中写入如下代码:

function pluginname_init() {
    // Replace the default index page
    elgg_register_plugin_hook_handler('index', 'system', 'new_index');

function new_index() {
    if (!include_once(dirname(dirname(__FILE__)) . "/pluginname/pages/index.php"))
        return false;

    return true;

// register for the init, system event when our plugin start.php is loaded
elgg_register_event_handler('init', 'system', 'pluginname_init');
  • Then, create an index page (/pluginname/pages/index.php) and use that to put the content you would like on the front page of your Elgg site.


电子邮件地址不会被公开。 必填项已用*标注