I'm coding a way to display the taxonomy terms, and I don't want some of the term pages to report "There is currently no content classified with this term." I need to remove that message form the term pages with no content, but let the content be listed like normal when there is content associated with that term.
2 Answers
This information is added in taxonomy_term_page(). As you can see there, the page callback returns a renderable array, which means that you can easily replace it in a custom module by implementing hook_page_alter().
In that hook, check that you are on a taxonomy term page, look if the 'no_content' block exists, and if yes, override the #markup.
I suggest to use dpm() from devel.module to print $page so that you can more easily figure out where exactly the page content is in that huge render array. Somewhere in system_main, if I remember correctly.
Another way of doing this is to add a class to the message using your template.php
function YOURTHEMENAME_process_page(&$variables) {
if(isset($variables['page']['content']['system_main']['no_content'])) {
$variables['page']['content']['system_main']['no_content']['#prefix'] = '<p class="empty-term">' ;
}
}
Then you can hide it, style it etc