I've done some looking around and couldn't find an answer for this, so I was hoping someone in the community did.
I have disabled the "Display post information" for both pages and stories, but the name of the user who posted the node is still displayed in search results.
How can I turn this off?
How to customize search results > solution
hi,
You can add this code to your theme's Template.php file. Just replace the THEME-NAME with your own theme name.
<?phpfunction THEME-NAME_search_item($item, $type) {
$output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt>';
$info = array();
$output .= ' <dd>'. ($item['snippet'] ? '<p>'. $item['snippet'] .'</p>' : '') .'<p class="search-info">'. implode(' - ', $info) .'</p></dd>';
return $output;
}
?>
Actually this theme function overrides the search result function in search.module.
here is the original code, you can leave some items like date or ...
<?phpfunction THEME-NAME_search_item($item, $type) {
$output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt>';
$info = array();
if ($item['type']) {
$info[] = check_plain($item['type']);
}
if ($item['user']) {
$info[] = $item['user'];
}
if ($item['date']) {
$info[] = format_date($item['date'], 'small');
}
if (is_array($item['extra'])) {
$info = array_merge($info, $item['extra']);
}
$output .= ' <dd>'. ($item['snippet'] ? '<p>'. $item['snippet'] .'</p>' : '') .'<p class="search-info">'. implode(' - ', $info) .'</p></dd>';
return $output;
}
?>
N.Mehrabany
Baruzh web design & programming