From f226e36bd59a82d159ae1a32c3212ec65616f4e5 Mon Sep 17 00:00:00 2001
From: ulaulaman
Date: Sat, 8 May 2021 01:15:54 +0200
Subject: [PATCH] Prime modifiche per risolvere issue segnalate
---
sidebars/astrodidattica.php | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/sidebars/astrodidattica.php b/sidebars/astrodidattica.php
index 1f30bbf..91a1c70 100644
--- a/sidebars/astrodidattica.php
+++ b/sidebars/astrodidattica.php
@@ -198,24 +198,23 @@ add_shortcode( 'sbdidattica', function () {
$collaborazione = null;
$terms = get_the_terms ( $post->ID, 'collaborazioni' );
- $numcat = sizeof( $terms );
- $i = 0;
- foreach ( $terms as $term ) {
- $term_link = get_term_link( $term, 'collaborazioni' );
- $i++;
- if ( $i < $numcat ) {
- $ente = $ente.'![](https://edu.inaf.it/wp-content/plugins/eduinaf/images/coll/'.$term->slug.'.png)
';
- } else {
- $ente = $ente.'
';
- }
- }
-
- if ( $i <> 0 ) {
- $collaborazione = 'In collaborazione con:
'.$ente.'
';
- $outnew = $outnew.$collaborazione;
- } else {
- $outnew = $outnew;
- }
+ if ( empty($terms) ) {
+ $collaborazione = null;
+ } else {
+ $numcat = sizeof( $terms );
+ $i = 0;
+ foreach ( $terms as $term ) {
+ $term_link = get_term_link( $term, 'collaborazioni' );
+ $i++;
+ $ente .= '
In collaborazione con:
'.$ente.'
';
+ $outnew = $outnew.$collaborazione;
+ }
$licenza = '![](https://i.creativecommons.org/l/by-nc/4.0/88x31.png)
Quest\'opera รจ distribuita con Licenza Creative Commons Attribuzione - Non commerciale 4.0 Internazionale.';