diff --git a/sidebars/costellazioni.php b/sidebars/costellazioni.php new file mode 100644 index 0000000..7cc021f --- /dev/null +++ b/sidebars/costellazioni.php @@ -0,0 +1,74 @@ +'; + + $out = $menu; + + return $out; +} ); + +# sidebar +add_shortcode( 'sbcostellazioni', function () { + + $custom = get_post_custom(); + foreach( $custom as $key => $value ) { + $key_name = get_post_custom_values( $key = 'ascensione_retta_centrale' ); + $field1 = '

Ascensione retta centrale: '.$key_name[0].'

'; + $key_name = get_post_custom_values( $key = 'declinazione_centrale' ); + $field2 = '

Declinazione centrale: '.$key_name[0].'

'; + $key_name = get_post_custom_values( $key = 'urlmappa' ); + $mappa = '

'; + if ( $key_name[1] <> null ) { + $mappa1 = '

'; + } else { $mappa1 = null; } + if ( $key_name[2] <> null ) { + $mappa2 = '

'; + } else { $mappa2 = null; } + } + $map = $mappa.$mappa1.$mappa2; + + $type = 'emisfero '; + $terms = get_the_terms ( $post->ID, 'emisfero' ); + $numcat = sizeof( $terms ); + $i = 0; + foreach ( $terms as $term ) { + $term_link = get_term_link( $term, 'emisfero' ); + $i++; + if ( $i < $numcat ) { + $type = $type.'
, '; + } else { + $type = $type.''; + } + } + + $terms = get_the_terms ( $post->ID, 'stagione' ); + $numcat = sizeof( $terms ); + if ( $numcat > 1 ) { + $season = 'Stagioni: '; + } else { + $season = 'Stagione: '; + } + $i = 0; + foreach ( $terms as $term ) { + $term_link = get_term_link( $term, 'stagione' ); + $i++; + if ( $i < $numcat ) { + $season = $season.', '; + } else { + $season = $season.''; + } + } + + + $visibile = '

Visibile in: '.$type.'

'.$season.'

'; + + $out = $map.$field1.$field2.$visibile; + + return $out; +} ); \ No newline at end of file