« first day (4 days earlier)    last day (15 days later) » 

5:52 AM
What did you see, if you click on: '0 (Array, 1 element)'
There should be a class name. Is it one of the class names that you want to add your class next to it?
I'll take a look once more on one of my projects, which I have a similar view that simply lists the latest nodes of a content type
So, my view setup is like that:
Format: Unformatted list, Settings - add view row classes is checked
Show: Fields
Fields: Title, Post date
Filter Criteria: Published, Content Type is set to my custom content type
Pager: Display a specific number of items (5 items)
I think it is very very similar to your views..
Only my view has the format unformatted list, and yours has HTML List as you stated before. I'll add a new display and set it to HTML list, so that I can use exactly the same function: mytheme_preprocess_views_view_list
 
6:28 AM
So, I added the same function and I see the new class in the dpm output but it isn't added to the list. that means there has to be another array that we need to change
 
6:47 AM
 classes (Array, 3 elements)
$...['classes']

    0 (Array, 5 elements)
        0 (String, 9 characters ) views-row
        1 (String, 11 characters ) views-row-1
        2 (String, 13 characters ) views-row-odd
        3 (String, 15 characters ) views-row-first
        4 (String, 13 characters ) something-new
But the html output is still:
<li class="views-row views-row-1 views-row-odd views-row-first">
 
7:15 AM
Eureka!
I took a look in the views theme.inc and found out that, the classes array is flattened to another variable called 'classes_array'
you need to do it as well in order to get your new class also added in this array
so the new code is:
function genesis_preprocess_views_view_list(&$variables) {
  $view = $variables['view'];
  if ($view->name == 'recent_views_widget') {
    foreach ($view->result as $key => $result) {
      if (time() - strtotime($result->node_created_day) < 14 * 24 * 60 * 60) {
        $variables['classes'][$key][] = 'new';
        $variables['classes_array'][$key] = isset($variables['classes'][$key]) ? implode(' ', $variables['classes'][$key]) : '';
      }
    }
  }
}
the second line simply checks if a classes array exists, and if exists flattens it to a string, separating all the classes with a space. and this works :)
i'll updated my answer on the question page as well
 
 
13 hours later…
8:03 PM
YES! I had the change "recent_views_widget" to "recent_news_widget" but THIS DID IT!
 
great to hear that it worked :)
 
I've just awarded you your bounty. I'll be cleaning this up later today. Thanks again; I'm indebted to your help.
 
8:19 PM
it was a good exercise for me :) and now I also know that the classes array must be flattened before rendering
and it was your luck that I had almost the same view setup on the project that I'm currently working on, so that I could check and test it out quickly
thank you for the bounty award :)
 
I'd love to use this for a blog post to help other's that want to do the same. This strikes me as a fairly common use-case for formatting a list of teasers/titles and that doing so would prove to be so difficult?
 

« first day (4 days earlier)    last day (15 days later) »