I developed a plugin but it is not working


Hello everyone, I have developed a plugin to modify the css of the elgg home screen, but it is not working I need help.

follow codes for analysis:


<?php function modifica_init()


$priority = 1000;


elgg_extend_view('elgg.css','views\default\estilo.css', $priority);


} ?>

I have the well-configured view folder and the css file inside it to replace.


Some things are in Portuguese because I'm Brazilian.


  • 1 - Move on github and share your code.

    2 - Learn docs.

    3 - Use the existing skeleton plugin.

    4 - Coding:

    So, your start.php should be:

    function modifica_init(){
        elgg_extend_view('elgg.css','estilo.css', 1000); // this means that your CSS file is located in /mod/YOUR_PLUGIN_NAME/view/default/estilo.css
  • Problem 1: You css is not working because other css might be getting a priority. You can try using !important in your css


     css_element: value!important;

    Problem 2: Your css is not loaded correctly. You can use the following code in your start.php file

    elgg_register_css('estilo',elgg_get_simplecache_url('estilo.css')); // this means that your CSS file is located in /mod/YOUR_PLUGIN_NAME/view/default/estilo.css

    Alternatively, you can also try the solution given by RvR to load your css.


  • Assuming your css file is at mod/modifica/views/default/modifica/estilo.css you would load ADDITIONAL css code simply by this line in the init function in start.php of your plugin:

    elgg_register_event_handler('init', 'system', 'modifica_init');
    function modifica_init() {

    If you place your "modifica" plugin at the bottom of the list of plugins in the admin section plugin page estilo.css will be added last to elgg.css.

    Depending on what changes you want to make it might not necessary to do it this way though. If you only want to modify the css code of an existing css file, you wouldn't "extend" a css file (e.g. elgg.css) but you would just place your modified file at the same subpath within your plugin as it has been in the other plugin (or of Elgg core). For example the Aalborg theme overrides the Elgg core file vendor/elgg/elgg/views/default/elements/layout.css by a modified file by placing the changed file at mod/aalborg_theme/views/default/elements/layout.css. The same can be done with a plugin if you want to override the css file of another plugin if you just place your plugin below the other to overide the original file with your modified file. Then you don't need to use elgg_extend_view() in start.php at all as Elgg handles the overriding of the files automatically.

    P.S. the closing ?> at the end of php files should not be added. Elgg handles this on its own already.