How do I use hook_views_pre_render in template.php in Drupal 7?
The hook is run for every view, therefore you need to inspect the $view object (the parameter passed to the function).

Place the function in your theme's template.php.

Name it YOURTHEMENAME_views_pre_render (ie  replace 'hook' with your theme name). Then use $view object to target specific view name and display_id, as in $view->name and $view->display_id (from memory, I might be wrong, but you get the gist).

function MYTHEME_views_pre_render(&amp;$view){
  if ($view-&gt;name == 'VIEWNAME' &amp;&amp; $view-&gt;display_id == 'DISPLAY_ID') {
    // do what you want
  }
}


If you want to do this for many views, best do it like this to separate the views into their own functions:

function MYTHEME_views_pre_render(&amp;$view){ {
  // will run for all views
  $function = __FUNCTION__ . '_' . $view-&gt;name;
  if (function_exists($function)) {
    $function($view);
  }
}

function MYTHEME_views_pre_render_VIEWNAME(&amp;$view){
  // will only run for specific view, but for all of its displays.
}