Customize page title format

traphouse

New Member
How can I change de Mailwizz page title format?

A few examples of the default format:
  • <Site name> | Please login
  • <Site name> | Dashboard
  • <Site name> | Campaigns
  • <Site name> | Your Lists
I want to change this to:
  • Please login - <Site name>
  • Dashboard - <Site name>
  • Campaigns - <Site name>
  • Your List - <Site name>
 
How can I change de Mailwizz page title format?
This can be changed by editing in each controller 'pageMetaTitle' param, but there is a lot to change and they will always be overwritten with each update.
 
Alternatively to what @laurentiu said, you could do it by creating a file called init-custom.php in /apps/ and put this code in it:
PHP:
<?php
    
function changePageTitleFormatHook() {
    $currentTitle = controller()->getData('pageMetaTitle', '');
    if (strpos($currentTitle, '|') === false) {
        return;
    }
    
    $parts = array_map('trim', explode('|', $currentTitle));
    $pageMetaTitle = implode(' - ', array_reverse($parts));

    controller()->setData('pageMetaTitle', $pageMetaTitle);
}

hooks()->addAction('backend_controller_before_render', 'changePageTitleFormatHook');
hooks()->addAction('customer_controller_before_render', 'changePageTitleFormatHook');
hooks()->addAction('frontend_controller_before_render', 'changePageTitleFormatHook');
 
Back
Top