apply_filters( 'sports_bench_standings_widget_head_row', $styles, $division )

Type

Filters

Section

Standings

Outputs styles for the table head row for the standings widget table

Parameters

  • $styles, string, current styles for the row
  • $division, stdClass object|integer, the data for the division or conference or 0 if the widget is using the league/all option

Returns

  • string, the CSS styles for the row

Since: 1.5

Source: standings.php, line 279, 284, 332, 338, 410, 416

Example

/**
 * Returns the styles for the table heading row for the standings widget table
 *
 * @param $styles, current styles for the table heading row
 *
 * @param $division, the division or conference the table is for
 *
 * @return string, styles for the table heading row
 *
 * @since 1.5
 */
function sports_bench_standings_widget_head_row_styles( $styles, $division ) {
    if ( 0 === $division ) {
        return 'background-color: #262626;';
    } else {
        if ( 'Conference' === $division->division_conference ) {
            return 'background-color: ' . $division->division_color;
        } else {
	        global $wpdb;
	        $table = $wpdb->prefix . 'sb_divisions';
	        $querystr = "SELECT * FROM $table WHERE division_id = $division->division_conference_id;";
	        $conference = $wpdb->get_results( $querystr );

	        return 'background-color: ' . $conference[ 0 ]->division_color;
        }
    }
}
add_filter( 'sports_bench_standings_widget_head_row', 'sports_bench_standings_widget_head_row_styles', 10, 2 );