diff --git a/sidebars/astrodidattica.php b/sidebars/astrodidattica.php index d73aa97..234e21f 100644 --- a/sidebars/astrodidattica.php +++ b/sidebars/astrodidattica.php @@ -26,20 +26,51 @@ add_shortcode( 'sbdidattica', function () { } } - $auth = 'di '; - $terms = get_the_terms ( $post->ID, 'autore_didattico' ); - $numcat = sizeof( $terms ); - $i = 0; - foreach ( $terms as $term ) { - $term_link = get_term_link( $term, 'autore_didattico' ); - $i++; - if ( $i < $numcat ) { - $auth = $auth.''.$term->name.', '; + $auth = null; + $custom = get_post_custom(); + foreach( $custom as $key => $value ) { + $key_name = get_post_custom_values( $key = 'autore_attivita' ); + if ( $key_name[0] <> null ) { + $auth1 = ''.$key_name[0].''; } else { - $auth = $auth.''.$term->name.''; + $auth1 = null; + } + if ( $key_name[1] <> null ) { + $auth2 = ', '.$key_name[1].''; + } else { + $auth2 = null; + } + if ( $key_name[2] <> null ) { + $auth3 = ', '.$key_name[2].''; + } else { + $auth3 = null; + } + if ( $key_name[3] <> null ) { + $auth4 = ', '.$key_name[3].''; + } else { + $auth4 = null; + } + + $auth = $auth1.$auth2.$auth3.$auth4; + } + + if ( $auth == null ) { + $terms = get_the_terms ( $post->ID, 'autore_didattico' ); + $numcat = sizeof( $terms ); + $i = 0; + foreach ( $terms as $term ) { + $term_link = get_term_link( $term, 'autore_didattico' ); + $i++; + if ( $i < $numcat ) { + $auth = $auth.''.$term->name.', '; + } else { + $auth = $auth.''.$term->name.''; + } } } + $auth = 'di '.$auth; + $curriculum = null; $curriculumastro = null; @@ -139,7 +170,7 @@ add_shortcode( 'sbdidattica', function () { $costo = null; } - $outnew = '
'.$img.'
'.$type.' '.$auth.'
'.$curriculum.''.$keyw.'
'.$livello.'
'; + $outnew = $img.''.$type.' '.$auth.'
'.$curriculum.''.$keyw.'
'.$livello.'
'; if ( $durata <> 'null' ) { $outnew = $outnew.''.$durata.'
'; @@ -168,7 +199,7 @@ add_shortcode( 'sbdidattica', function () { $term_link = get_term_link( $term, 'collaborazioni' ); $i++; if ( $i < $numcat ) { - $ente = $ente.'