Home › Forum › Problemi Vari con WP › Problema con un text widget
-
AutorePost
-
-
4 Febbraio 2009 alle 17:43 #9351enricofPartecipante
Ho aggiunto un widget testuale (non è stato il primo), ma lo script deve essere sbagliato perchè da quel momento mi compare il seguente errore:
Warning: array_keys() [function.array-keys]: The first argument should be an array in /web/htdocs/www.folblog.it/home/wp-includes/widgets.php on line 1044
Il problema è che nella admin page dei widget (uso WP 2.7), dato che l’esecuzione del codice viene interrotta, non compare più il widget e non ho la possibilità quindi di sistemarlo.
Mi sapete dire dove si trovano memorizzati i vari widget in modo che possa eliminare manualmente quello che causa problemi?
Grazie
-
4 Febbraio 2009 alle 17:53 #62210SteveAglAmministratore del forum
i widget nonsono codificati separaetamente ma sono inclusi nel file wp-includes/widgets.php ma nella tabella wp_options c’è una voce sidebars_widgets che contiene le impostazioni dei widget per il tema, solo che i dati sono serializzati.. non banali da editare, ma se azzeri il suo valore non avrai più alcun widget attivo.
-
4 Febbraio 2009 alle 19:51 #62217enricofPartecipante
Questo è il contenuto della voce sidebar_widgets nella tabella wp_options.
a:3:{s:9:”sidebar-1″;a:8:{i:0;s:9:”tag_cloud”;i:1;s:14:”text-235628391″;i:2;s:14:”text-344441971″;i:3;s:16:”top-commentators”;i:4;s:15:”recent-comments”;i:5;s:12:”recent-posts”;i:6;s:13:”most-comments”;i:7;s:11:”most-viewed”;}s:9:”sidebar-2″;a:12:{i:0;s:6:”text-3″;i:1;s:14:”text-208830041″;i:2;s:14:”text-336735112″;i:3;s:20:”categories-262017751″;i:4;s:6:”text-5″;i:5;s:14:”text-249555001″;i:6;s:14:”text-342031971″;i:7;s:14:”text-337629551″;i:8;s:14:”text-346196591″;i:9;s:5:”links”;i:10;s:8:”calendar”;i:11;s:8:”archives”;}s:13:”array_version”;i:3;}
In effetti è un gran casino capire come sono strutturati i dati.
Eppure mi basterebbe eliminare il text widget che causa il problema.
Mi pare di capire che qui ci sono i dati di entrambe le sidebars e quella evidenziata è la sidebar 1 in cui non c’è alcun problema.
“sidebar-2”;a:12 dovrebbe essere l’inizio della Sidebar2 che conterrebbe (vado ad occhio interpretando quel a:12) 12 elementi.
A naso il parametro i:n sembra l’ordine in cui i widget devono apparire nella sidebar.
s: che significa? Forse la lunghezza della stringa “text-xxxxxxxxx”?
E “text-xxxxxxxx” sembra individuare i text widget
la struttura di ciascun text widget dovrebbe essere quindi composta da questi parametri:
i:x;s:y:”text-zzzzzzzzz“
dove x, y e zzzzzz sono parametri variabili.
Qualunque modifica tenti qui causa la mancataq visualizzazione dell’intera pagina admin dei widget anzichè la mancata visualizzazione di tutti i text widget.
Qualcuno sa come interpretare i questi dati?
-
4 Febbraio 2009 alle 21:03 #62219SteveAglAmministratore del forum
Non ho idea perchè NON ho mai guardato il codice di WP che fa ste cose… cancella l’intera riga di DB e accederai ai widget che poi dovrai reimpostare…
-
4 Febbraio 2009 alle 21:43 #62224enricofPartecipante
Ci son riuscito!
E’ stata dura ma ci son riuscito.
Allora le voci da variare sono state:
sidebar_widtget
widget_text
widget_cache
a: indica il numero di elementi dell’array (quindi elmininando un elenemto occorre diminuirlo di 1)
s: indica il numero di caratteri dell’elemento
i: indica la posizione nella sidebar
Ho eliminato da widget_text il text widget incriminato, decrementando di 1 il numero degli elementi conteggiati nell’array
Ho eliminato il widget dalla sidebar decrementando il numero degli elementi dell’array (sidebar-2″;a:12 e diventato sidebar-2″;a:11). Ciascun widget è identificato da “text-xxxxxxxx” (qello incriminato era “text-337629551”).
Ho eliminato anche da widget_cache il riferimento al widget “text-337629551”
Ed ora funziona nuovamente tutto.
Fiuuuu
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.