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

Type

Filters

Section

Standings

Outputs styles for the table head row for the standings table

Parameters

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

Returns

  • string, the CSS styles for the row

Since: 1.5

Source: standings.php, line 479, 525, 587, 672, 796, 922, 1044, 1216, 1415

Example

/**
 * Returns the styles for the table heading row for a standings page table
 *
 * @param $styles, the 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_page_table_head_styles( $styles, $division ) {

	global $wpdb;
	$table = $wpdb->prefix . 'sb_divisions';
    if ( $division !== 0 ) {
        if ( is_object( $division ) ) {
	        if ( 'Conference' == $division->division_conference ) {
		        $styles = 'background-color: ' . $division->division_color . '; border-right-color: ' . $division->division_color . '; border-left-color: ' . $division->division_color . ';';
	        } else {
		        $querystr   = "SELECT * FROM $table WHERE division_id = $division->division_conference_id;";
		        $conference = $wpdb->get_results( $querystr );
		        $styles     = 'background-color: ' . $conference[0]->division_color . '; border-right-color: ' . $conference[0]->division_color . '; border-left-color: ' . $conference[0]->division_color . ';';
	        }
        } else {
	        $querystr   = "SELECT * FROM $table WHERE division_id = $division;";
	        $conference = $wpdb->get_row( $querystr );
	        if ( $conference && 'Conference' == $conference->division_conference ) {
		        $styles = 'background-color: ' . $conference->division_color . '; border-right-color: ' . $conference->division_color . '; border-left-color: ' . $conference->division_color . ';';
	        } elseif ( $conference ) {
		        $querystr   = "SELECT * FROM $table WHERE division_id = $conference->division_conference_id;";
		        $conference = $wpdb->get_results( $querystr );
		        $styles     = 'background-color: ' . $conference[0]->division_color . '; border-right-color: ' . $conference[0]->division_color . '; border-left-color: ' . $conference[0]->division_color . ';';
	        }
        }
    }

    return $styles;
}
add_filter( 'sports_bench_standings_head_row', 'sports_bench_standings_page_table_head_styles', 10, 2 );