You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
La pagina dell' Amministrazione trasparente non si apre perché nella creazione dei link delle categorie e sottocategorie riceve anche dei dati di tipo WP_Error invece di classiche stringhe.
I file affetti da questo problema sono i seguenti:
/page-templates/amministrazione-trasparente.php
Fatal error
: Uncaught Error: Object of class WP_Error could not be converted to string in /var/www/vhosts/SCUOLA.edu.it/httpdocs/wp-content/themes/design-scuole-wordpress-theme-main/page-templates/amministrazione-trasparente.php:62
/template-parts/search/filters-amministrazione.php
Fatal error: Uncaught Error: Object of class WP_Error could not be converted to string in /var/www/vhosts/SCUOLA.edu.it/httpdocs/wp-content/themes/design-scuole-wordpress-theme-main/template-parts/search/filters-amministrazione.php:43
Per risolvere il problema ho proceduto alle seguenti modifiche:
/page-templates/amministrazione-trasparente.php LINEA 62 sostituita con: // FIX Uncaught Error: Object of class WP_Error could not be converted to string $testString = get_term_link( get_term_by('name', $value, 'amministrazione-trasparente'), 'amministrazione-trasparente' ); if (gettype($testString)=="string") { $atreturn .= '<a href="' .$testString.'" title="' . $value . '">' . $value . '</a>'; $atreturn .= '</li>'; }
/template-parts/search/filters-amministrazione.php LINEA 43 sostituita con: // FIX Uncaught Error: Object of class WP_Error could not be converted to string $testString = get_term_link( get_term_by('name', $value, 'amministrazione-trasparente'), 'amministrazione-trasparente' ); if (gettype($testString)=="string") { $atreturn_body .= ' <label class="mb-0" for="check-'.$term->slug.'"><a href="' . $testString . '">'.$term->name.'</a></label>'; $atreturn_body .= '</div>'; $atreturn_body .= '</li>'; }
`
Includi link o screenshot
Su quale sisitema operativo stai riscontrando il problema?
Windows
Su quale browser stai riscontrando il problema?
Qualsiasi
Che versione del tema stai utilizzando?
2.5.1
The text was updated successfully, but these errors were encountered:
Credo che il problema stia nell'utilizzo della funzione dsi_amministrazione_trasparente_array() definita nel file:
"design-scuole-wordpress-theme-main\inc\vocabolario.php"
perchè restituisce un array predefinito che contiene tutte le categorie dell'amministrazione trasparente (senza prenderle dal db, è lo stesso array utilizzato per popolare la sezione amministrazione trasparente al momento dell'installazione del tema), sulle quali poi i files:
/page-templates/amministrazione-trasparente.php
/template-parts/search/filters-amministrazione.php
invocano la funzione get_terms() per ricavarne i dettagli, se però ho modificato le categorie dell'amministrazione trasparente dal backend, la funzione get_terms() restituirà degli errori perchè non trova i terms nel db, li cerca a partire dall'array di dsi_amministrazione_trasparente_array(), ma nel db non li trova,
bisognerebbe scrivere una funzione che invece di restituire l'array dei terms predefiniti, li prende direttamente dal db, in modo tale che se ho fatto delle modifiche all'albero delle categorie dell'amministrazione trasparente funziona comunque tutto, ho aggiunto questa funzione al file del vocabolario:
e ho chiamato questa funzione invece di dsi_amministrazione_trasparente_array() nei files:
/page-templates/amministrazione-trasparente.php
/template-parts/search/filters-amministrazione.php
mi sembra funzioni correttamente, l'unica differenza è che nella pagina saranno visualizzate le categorie di documenti che contengono almeno un documento, questo perchè get_terms() restituisce solo i terms che hanno un valore di count superiore a 0.
Questo problema è stato automaticamente contrassegnato come non aggiornato perché non ha avuto attività recentemente. Sarà chiuso se non si verificano ulteriori attività. Considerate inoltre l'aggiornamento alle ultime versioni del tema. Grazie.
Prerequisiti
Descrivi il problema
La pagina dell' Amministrazione trasparente non si apre perché nella creazione dei link delle categorie e sottocategorie riceve anche dei dati di tipo WP_Error invece di classiche stringhe.
I file affetti da questo problema sono i seguenti:
/page-templates/amministrazione-trasparente.php
Fatal error
: Uncaught Error: Object of class WP_Error could not be converted to string in /var/www/vhosts/SCUOLA.edu.it/httpdocs/wp-content/themes/design-scuole-wordpress-theme-main/page-templates/amministrazione-trasparente.php:62
/template-parts/search/filters-amministrazione.php
Fatal error: Uncaught Error: Object of class WP_Error could not be converted to string in /var/www/vhosts/SCUOLA.edu.it/httpdocs/wp-content/themes/design-scuole-wordpress-theme-main/template-parts/search/filters-amministrazione.php:43
Per risolvere il problema ho proceduto alle seguenti modifiche:
/page-templates/amministrazione-trasparente.php LINEA 62 sostituita con:
// FIX Uncaught Error: Object of class WP_Error could not be converted to string $testString = get_term_link( get_term_by('name', $value, 'amministrazione-trasparente'), 'amministrazione-trasparente' ); if (gettype($testString)=="string") { $atreturn .= '<a href="' .$testString.'" title="' . $value . '">' . $value . '</a>'; $atreturn .= '</li>'; }
/template-parts/search/filters-amministrazione.php LINEA 43 sostituita con:
// FIX Uncaught Error: Object of class WP_Error could not be converted to string $testString = get_term_link( get_term_by('name', $value, 'amministrazione-trasparente'), 'amministrazione-trasparente' ); if (gettype($testString)=="string") { $atreturn_body .= ' <label class="mb-0" for="check-'.$term->slug.'"><a href="' . $testString . '">'.$term->name.'</a></label>'; $atreturn_body .= '</div>'; $atreturn_body .= '</li>'; }
`
Includi link o screenshot
Su quale sisitema operativo stai riscontrando il problema?
Windows
Su quale browser stai riscontrando il problema?
Qualsiasi
Che versione del tema stai utilizzando?
2.5.1
The text was updated successfully, but these errors were encountered: