Skip to main content

better_messages_header_element

REQUIREMENTS

To be able to implement this guide, you need to learn how to use JS snippets at your website.

One of guides: https://dev.to/david_woolf/how-to-get-started-with-wordpress-hooks-in-javascript-400o

Compatibility
This hook compatible with Better Messages 2.1.3 or higher
wp.hooks.addFilter('better_messages_header_element', 'custom_action', function(element, screen, isMobileView){
// is mobile view?
// console.log(isMobileView);
// console.log(currentScreen);

if( screen === 'index' ){
// Replace with custom html
var html = '<div class="my-custom-html">Add <strong>custom</strong> data</div>'
return html;
}

// Return element if you dont want to replace header based on conditions
return element;
});

The html will replace the header.

better_messages_header_element