Components as $component ) { register_setting( 'chmu-settings-group', 'chmu_show_' . $component->Code ); } foreach ( chmu_get_data()->Legend as $legend ) { register_setting( 'chmu-settings-group', 'chmu_legend_' . $legend->Ix ); } } /** * Render the settings page * This utilizes the WP Settings API https://codex.wordpress.org/Creating_Options_Pages */ function chmu_settings_page() { ?>

Administrativní nastavení

Components as $component ) { ?>
Code; ?> Code ) ); ?>/>

Vložte popis pro kvalitu ovzduší:

Legend as $legend ) { ?>
Ix; ?>
States as $state ) { foreach ( $state->Regions as $region ) { foreach ( $region->Stations as $station ) { $stations[ $station->Code ] = $station; } } } return $stations; } /** * Get the legend * @return mixed */ function chmu_get_legend() { return chmu_get_data()->Legend; } /** * get a single station by code * * @param $code * * @return mixed */ function chmu_get_station_by_code( $code ) { $stations = chmu_get_stations(); return $stations[ $code ]; } /** * Get last update date * @return mixed */ function chmu_get_last_update() { return get_option( 'chmu_last_update', '' ); } /** * Add the shortcode */ add_shortcode( 'chmu_widget', 'chmu_render_widget' ); function chmu_render_widget() { ob_start(); $station = chmu_get_station_by_code( get_option( 'chmu_station' ) ); $legend = chmu_get_legend(); $rating = false; foreach ( $legend as $item ) { if ( $item->Ix === $station->Ix ) { $rating = $item; break; } } $style = ''; if ( $rating ) { $style = "background-color: #$rating->Color; color: #$rating->ColorText"; } ?>

Name ); ?>

Kvalita ovzduší: Ix;?>, Description?>


Ix ) ?>

Components as $component ) { if ( get_option( 'chmu_show_' . $component->Code ) != 1 ) { continue; } if ( $i % 2 == 0 ) { ?>
Code; ?> : Val ) ? $component->Val : '-'; ?>

Data jsou čerpána z ČHMÚ