你好John:
我想这就是您想要的(我会解释代码,因为我认为它是不言自明的;如果不是,请告诉我):
<?php
add_filter(\'dynamic_sidebar_params\',\'my_dynamic_sidebar_params\');
function my_dynamic_sidebar_params($params) {
$sidebar_id = $params[0][\'id\'];
$sidebar_widgets = wp_get_sidebars_widgets();
$last_widget_id = end($sidebar_widgets[$sidebar_id]);
if ($last_widget_id==$params[0][\'widget_id\'])
$params[0][\'before_widget\'] = str_replace(\' class="\',\' class="last_widget \',$params[0][\'before_widget\']);
return $params;
}