From b765167fade56c1c2aaa55544a40cb30828e94f7 Mon Sep 17 00:00:00 2001 From: ulaulaman Date: Thu, 22 Oct 2020 19:26:13 +0200 Subject: [PATCH] Correzioni e aggiornamenti vari --- sidebars/astrodidattica.php | 55 +++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 12 deletions(-) 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.', '; + $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.''; + $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.', '; + } else { + $auth = $auth.''; + } } } + $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.'
'; + $ente = $ente.'
'; } else { $ente = $ente.''; }