Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I currently have this in template.php to remove the 'username's blog' link from blog entries.

function phptemplate_links($links, $attributes = array()) {
    unset($links['blog_usernames_blog']);
    return theme_links($links, $attributes);
}

How would I go about using unset to remove the 'username's blog' link from the search results page?

share|improve this question
    
On my site 'username's blog' isn't in search results. - Also I would be wary of any answers recommending you unset or hide the search result info, because that info contains a number of different things and you probably don't want to get rid of it all. –  rooby Apr 22 '13 at 13:24

3 Answers 3

Consider using Display Suite module.

To make changes to search results for article content type, Goto admin/structure/types/manage/article/display and enable the search result custom display.

Then visit admin/structure/types/manage/article/display/search_result and add or remove the fields as per your requirement.

share|improve this answer

You can implement using ThemeName_preprocess_search_result() function. Just Refer this link from Drupal.org: http://drupal.org/node/1101554#comment-5345554

/**
    * Process variables for search-result.tpl.php.
    *
    * @see search-result.tpl.php
    */
    function YOUR_THEME_NAME_preprocess_search_result(&$variables) {
      // Remove user name and modification date from search results
      $variables['info'] = '';
    }

Another solution is that you can override the search-result.tpl.php file in your theme folder. Just remove following snippet from the file:

<?php if ($info): ?>
      <p class="search-info"><?php print $info; ?></p>
    <?php endif; ?>
share|improve this answer
    
This broke the drupal site and stopped it loading :/ –  slawrence10 Oct 3 '12 at 10:48
    
check the edit of the answer –  mohit_rocks Oct 3 '12 at 11:07
    
Hey, I had already done this to remove the authors name and publishing date for entries but it doesn't remove the user blog URL –  slawrence10 Oct 3 '12 at 11:30
    
so do you want to hide xyz's blog xx reads information form search results ? xyz: user name xx: number of reads and various other attributes –  mohit_rocks Oct 3 '12 at 11:37
    
I think it is coming $info_split variable, when i did var_dump($info_split) then it showed me lots of attributes. You can unset some of these variables. Just see the comments of search-result.tpl.php –  mohit_rocks Oct 3 '12 at 12:16

one simple way without any change in template files.. Just add following code in your css.

.search-info {
display: none;
}

It done all the tricks..

Hope this will help you.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.