Home › Forum › Problemi Vari con WP › Problema modifica css in tema child
-
AutorePost
-
-
13 Settembre 2015 alle 16:49 #30073stefaaaPartecipante
Salve a tutti.
Ho cercato ovunque per giorni, ma non riesco a risolvere il mio problema:
sto provando a personalizzare il template wordpress twenty fifteen e premetto che ora sto imparando a capirci qualcosa.
Dopo aver fatto un tema figlio, attivato e dunque identico al tema padre, ho problemi a cambiare elementi nel foglio di stile.
Mi spiego meglio: ho provato in qualsiasi modo a modificare, ad esempio, la grandezza e il tipo di font, oppure a ridurre lo spazio occupato dalla sidebar a sinistra, senza avere però nessun risultato; in pratica modifico ma non succede nulla. Ragion per cui ho usato plugin, però, per non appesantire il tutto e per poter fare piccole modifiche senza l’ausilio di ulteriori plugin, vorrei risolvere questa faccenda.
In un altro topic trovato su questo forum leggevo di un’ipotetica soluzione: cambiare get_template_directory_uri() con get_stylesheet_directory_uri() nel file header.php, ebbene dopo aver copiato esattamente il file header.php dal padre al tema figlio e modificato quanto suggerito, ancora non ho risultati.
Ripeto che il tema child è attivato e sembra non avere problemi.
Il sito che sto costruendo è questo e ovviamente è ancora in fase di sviluppo.
Grazie mille per l’interesse.
-
14 Settembre 2015 alle 9:42 #118702TittiModeratore
Premesso che questo non è un forum di CSS e quindi l’aiuto qui potrebbe esser limitato, manca la domanda. Scegli cosa chiedere nello specifico (un argomento alla volta per topic), dai le informazioni utili sulla pagina con il problema e su cos’hai fatto esattamente (ho provato in qualsiasi modo non dice nulla di utile).
-
14 Settembre 2015 alle 10:28 #118705stefaaaPartecipante
Chiedo scusa:
la mia domanda è: in wordpress, dopo aver fatto un tema child, con file function.php e style.css che funziona bene, quindi identico al tema padre, come faccio a modificare il foglio di stile?
Leggendo online capisco che basta aggiungere semplicemente al file style.css del tema child, sotto le righe necessarie alla sua creazione, i codici da modificare.
Ma qualunque sia il codice che io inserisco, non vedo nessuna modifica e nessun tipo di risultato.
Dunque mi chiedevo cosa stessi sbagliando.
Esempio pratico: vorrei modificare la grandezza della sidebar a sinistra. Apro Filezilla, apro il tema figlio in questione, visualizzo il file style.css e ci scrivo:
.sidebar {
float: left;
margin-right: -100%;
max-width: 413px;
position: relative;
width: 29.4118%;
}
E modifico width e carico, non succede nulla.
Quindi in sintesi la domanda è: perché non riesco a modificare lo style.css del mio tema figlio (uso Filezilla)? Cosa sbaglio?
Spero di essere stata più chiara, grazie a tutti.
-
14 Settembre 2015 alle 11:42 #118706TittiModeratore
A parte che nel foglio stile del child non devi ripetere le stesse proprietà dell’originale, ma inserire SOLO quella che vuoi cambiare (ad es., .sidebar {width: …}) o aggiungere, ho l’impressione che tu abbia sbagliato qualcosa nel functions.php, quindi vai su pastebin e incolla esattamente quello che hai in quel file, e riporta qui il link al file di pastebin affinché possiamo vedere cos’hai scritto.
Inoltre, cancella il file header.php che hai inserito nel child, hai capito male e per fare quello che vuoi tu non c’entra quella cosa.
PS: poi dipende anche da come modifichi width, non l’hai detto.
-
14 Settembre 2015 alle 15:31 #118714stefaaaPartecipante
Ah ok, il file header.php l’avevo già rimosso perché appunto non succedeva niente. QUindi nel tema figlio ho style.css e functions.php, e a questo link puoi leggere ciò che è contenuto nel file functions da pastebin (spero di averlo copiato bene!).
Se ho ben capito da ciò che dici per modificare il foglio di stile, ad esempio per la sidebar, devo riportare SOLO il valore width (quindi senza incollare tutto ciò che è contenuto nelle { }, tipo position, margin-right….), giusto?
Per quanto riguarda invece le modifiche che vorrei fare, sempre se non mi sbaglio, dovrei ottenere comunque la somma del content e della sidebar (riferendomi al width), che ora è di 100. Quindi per averla più stretta immagino di doverla impostare a 20% e di conseguenza il content di 80%…
Grazie per la pazienza, sto cercando di destreggiarmi in qualche modo!
-
14 Settembre 2015 alle 18:10 #118715TittiModeratore
Il functions.php cosଠcom’è va bene per il tema Fifteen, ma onde evitare errori di sintassi scarica questo e caricalo al posto di quello che hai ora.
Sଠnel foglio stile child devi scrivere solo ciò che cambi o aggiungi.
Per quello che vuoi fare può andar bene mettere le percentuali che vuoi in .sidebar e .site-content, mantenendo però le media queries originali, quindi
@media screen and (min-width: 59.6875em) {
.site-content {
width: 80%;
}
.sidebar {
width: 20%;
}
}Deve funzionare per forza.
-
14 Settembre 2015 alle 18:58 #118716stefaaaPartecipante
Grazie Titti, ma mi credi non succede niente. Ho fatto quanto mi hai detto e ti dirò di più: ho provato anche a inserire le modifiche tramite il custom CSS che è compreso nel plugin Jetpack …. se clicco anteprima vedo modifiche, ma una volta salvate, torna tutto come prima.
Ora non so se centri qualcosa… a naso direi di si… Non so più come cercare, è come se non fosse possibile modificarlo, oppure continuo a sbagliare qualcosa..
-
14 Settembre 2015 alle 19:54 #118717TittiModeratore
Disattiva il plugin di maintenance mode, cosଠcontrollo.
Il child cosଠcom’è va bene (il functions al link che ti ho messo e il foglio stile con le modifiche che ti ho scritto, e ovviamente la sua intestazione come avevo visto che avevi fatto).
-
14 Settembre 2015 alle 20:09 #118718stefaaaPartecipante
Si, devi scusarmi, disattivato (avevo disattivato tutti i plugin per provare a fare le modifiche e nel riattivarli…ho riattivato anche quello)
-
14 Settembre 2015 alle 20:19 #118719TittiModeratore
Disattiva tutti i plugin, non pare un problema di cache del browser, ma se hai un plugin di cache, svuota la cache prima di disattivarlo.
-
14 Settembre 2015 alle 21:03 #118720stefaaaPartecipante
Fatto, ma niente di niente. Ci avevo provato già prima come ti dicevo…
Ti ringrazio dell’aiuto che ho ricevuto fino ad ora, io proprio non capisco come mai… seguo il tutorial per fare questo tema child, faccio tutto seguendo passo passo, grazie al tuo aiuto mi sono chiarita i dubbi che avevo (cioé come inserire le cose nel foglio di stile)… ma nulla.
Non so nemmeno più come cercare..
-
14 Settembre 2015 alle 21:06 #118721TittiModeratore
àˆ un conflitto con un plugin, riattivali uno ad uno e controlla ogni volta aggiornando la pagina fino a scoprire il colpevole.
Poi cambiamo le regole che ti ho dato nel foglio stile perché quelle non vanno bene, ma questo ora non c’entra.
Edit: come niente di niente? Le modifiche ora si vedono, e il foglio stile child è caricato, basta che vedi qua:
http://stefaniaciardi.com/wp-content/themes/twentyfifteen-child/style.css?ver=4.3
-
14 Settembre 2015 alle 21:17 #118722TittiModeratore
Quando hai scoperto di quale plugin si tratta, tienilo disattivato per il momento.
Ti lascio le correzioni al foglio stile perché 80 e 20 non vanno bene come percentuali, devi mettere 77 e 23 e diminuire il margine sinistro del content, altrimenti si allarga troppo e hai la barra di scorrimento.
@media screen and (min-width: 59.6875em) {
.site-content {
width: 77%;
margin-left: 23%;
}
.sidebar {
width: 23%;
}
} -
14 Settembre 2015 alle 21:23 #118723stefaaaPartecipante
Uhm… mi sa che non ti seguo.
Quando dici “il foglio di stile è preso” intendi che si vede l’intestazione giusto?
Se si… quella c’è sempre stata credo. Ma non dovremmo vedere pure le modifiche aggiunte (quelle scritte da te per modificare width della sidebar) ?
EDIT: scusa sto rileggendo quanto hai scritto. mi dicevi che vedevi le modifiche… ho sempre più dubbi che sto ignorando qualcosa perché io proprio non vedo nulla.
-
15 Settembre 2015 alle 11:53 #118724TittiModeratore
Le modifiche sono attive perché ora il foglio stile viene caricato (link sopra), a differenza di prima. Se usi Firebug, le vedi anche da là¬.
Se le vedo io le possono vedere tutti, compresa te.
Avrai una cache persistente, svuotala o cambia browser/pc, mantieni i plugin disattivati e fai logout.
Oppure, semplicemente, avendo tu lo sfondo tutto bianco, e non essendo modifiche cosଠevidenti, non te ne rendi conto, ma si nota anche dal fatto che ora il content è attaccato alla sidebar.
-
15 Settembre 2015 alle 13:54 #118733stefaaaPartecipante
Ok, ho provato da un altro pc, dopo aver svuotato la cache…ma niente, io non riesco proprio a vedere differenze.
Per levarmi ogni dubbio che sia un problema mio e dello sfondo bianco che inganna… posso provare a mettere proporzioni esagerate alle percentuali width in modo tale da avere un cambiamento più evidente?
Del tipo mettendo 95% e 5% dovrei vedere un grosso cambiamento giusto? E invece nulla.. anche facendo logout, da altro pc, senza plugin…
-
15 Settembre 2015 alle 16:30 #118735TittiModeratore
Nonostante sia segnalato un errore sul tuo file functions a livello di add_action (Call to undefined function add_action()), che avevo già visto ieri, questo, anche se in teoria potrebbe essere una causa di non funzionamento del tema figlio, in pratica non credo lo sia, dato che io i cambiamenti li vedo (e li vedo perché il foglio stile child è effettivamente caricato). Inoltre mi pare strano che ci sia un errore su una chiamata standard a una funzione che è definita da WP, dichiarata nel Codex e su un tema standard – è un errore che è più facile che succeda su un altro tema.
Quando hai personalizzato il tema mettendo il colore bianco di sfondo, l’hai fatto dalla bacheca immagino, e sul fifteen originale?
Prova a fare cosà¬:
Scarica un nuovo pacchetto di fifteen da qui
Attiva un altro tema standard, il fourteen ad es.
Via FTP vai nella cartella themes e scarica in locale il fifteen-child, poi cancelli (dalla cartella) sia fifteen che fifteen-child.
Alla fine carichi il fifteen originale che hai scaricato.
Vai in bacheca, attivalo, e guarda che sia tutto a posto.
Vai in Impostazioni > Permalink e scegli una struttura, salva.
Aggiorna qualche pagina e guarda che abbia preso la nuova struttura URL.
Via FTP carica il tema figlio.
Poi attivalo e vedi che succede.
-
15 Settembre 2015 alle 18:02 #118736stefaaaPartecipante
Allora il tema che avevo è twenty-fifteen (quello linkato da te è il fifteen), quindi ho seguito le tue istruzioni ma facendo il download del tema twenty-fifteen.
A quel tema io avevo cambiato solo, dal pannello “personalizza” e poi “colore”, il colore dello sfondo da grigio a bianco, poi ho fatto il tema figlio.
Seguendo tutto ciò che mi hai detto in effetti vedo le modifiche. Ma è come se fosse “fisso” e cioé cancello o inserisco le modifiche:
@media screen and (min-width: 59.6875em) {
.site-content {
width: 77%;
margin-left: 23%;
}
.sidebar {
width: 23%;
}
}
il risultato rimane sempre uguale (ossia con il contenuto principale più a sinistra).
Quindi se dovessi volerlo modificare diversamente o aggiungere altro non cambierebbe… Questo non mi spiego..
(continuo a ringraziarti infinitamente)
-
15 Settembre 2015 alle 18:32 #118737TittiModeratore
Scusa per il tema, ovviamente era chiaro che era il twenty, ma la fretta…
OK, è definitivamente un problema di cache, non del browser però ma a livello di server.
Che hosting hai? Apri un ticket con loro, perché credo sia quello.
-
15 Settembre 2015 alle 22:59 #118738stefaaaPartecipante
Sisi grazie, avevo capito che l’errore fosse dovuto alla fretta, era giusto per conferma
Uso Godaddy, dici che devo rivolgermi a loro?
ti ringrazio infinitamente
-
16 Settembre 2015 alle 6:48 #118739TittiModeratore
Sà¬. A questo punto è evidente che, per aver performance competitive, hanno una cache a livello del server che si aggiorna solo se fai richieste al database, cioè via bacheca (come abbiamo visto, personalizzazione tema, disattivazione/attivazione plugin e temi, cambio permalink…), quindi non i cambiamenti via FTP.
Probabilmente se apportassi un cambiamento al contenuto del CSS da bacheca attraverso l’editor dei temi funzionerebbe da subito, e questa potrebbe essere la prima soluzione a portata di mano per aggirare il problema.
Ma rimane tuttavia un problema da dover gestire (e ai non esperti io sconsiglio modifiche ai file via editor della bacheca), quindi devi chiedergli se hanno almeno previsto un sistema di svuotamento cache con un pulsante, o di non usare la cache con gli utenti logged in o amministratori, proprio come avviene con i plugin di cache.
-
16 Settembre 2015 alle 10:14 #118746stefaaaPartecipante
Ok, grazie allora. Provo a scrivere a loro.
Ho provato comunque a fare modifiche dall’editor… nemmeno cosଠle vedo..
Grazie mille comunque.
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.