Archive Widget – Count only parent posts

I haven’t tested this, but I found a sample that was close. I have modified it to be similar to what you want. I’m not sure it is 100%, but it should get you really close:

add_action('pre_get_posts','wpse_filter_parents_only');

function wpse_filter_parents_only($query){
    if (!is_admin() && is_category('26')){
        $query->set('post_parent',0);
    }
    return $query;
}

This should update what WP_Query retrieves from the database, and only for category 26. If you need this to affect multiple categories, stuff them into an array and insert the array like this: is_category($cats).

Hope this helps!