Home › Forum › Problemi Vari con WP › come rimuovere una sezione dal personalizza tema
-
AutorePost
-
-
18 Dicembre 2016 alle 4:14 #31217stenojazzyPartecipante
Buongiorno a tutti, sono Stefano e mi sono appena iscritto al vostro Forum.
Vorrei cortesemente chiedere un aiuto perchè ho provato in tutti i modi ma non c’è verso.
Ho bisogno di rimuovere alcune voci (sezioni) dal personalizza di wordpress (aspetto->personalizza): per capire meglio ho bisogno, per esempio, di nascondere la voce “denominazione sito” oppure “immagine dell’header”, ecc. dal menu del “personalizza”.
Per favore, potete segnalarmi un metodo che possa funzionare?
Al momento uso wp 4.6.1
Vi ringrazio davvero tanto
Saluti a tutti
Stefano
-
18 Dicembre 2016 alle 16:24 #121124TittiModeratore
Rimuovere o nascondere? E poi, a che scopo?
-
18 Dicembre 2016 alle 22:17 #121125stenojazzyPartecipante
Nascondere.
Allo scopo di preparare un “pannello” personalizzato per la customizzazione del tema.
Grazie
-
19 Dicembre 2016 alle 11:57 #121126TittiModeratore
Nascondere se hai intenzione di personalizzare ulteriormente non è adatto, si fa con i CSS comunque ma potrebbe esser complicato.
Meglio usare una funzione che potrai gestire come vuoi rimuovendo, aggiungendo e/o rinominando non solo sezioni ma anche singoli controlli. Devi conoscere un po’ di PHP.
Nel tuo caso costruirai una funzione usando $wp_customize->remove_section( ‘section_id’); trovando con gli strumenti di ispezione del browser l’id della sezione o del controllo che intendi personalizzare.
Per rimuovere solo controlli: $wp_customize->remove_control( ‘control_id’ );.
Leggi https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/remove_section e un altro link utile: https://developer.wordpress.org/themes/advanced-topics/customizer-api/
Ad esempio puoi partire da una cosa cosà¬, per rimuovere “denominazione sito”
// Rimuovi sezioni dal theme customizer
add_action( 'customize_register', 'slugtema_customize_register' );
function slugtema_customize_register( $wp_customize ) {
$wp_customize->remove_section( 'title_tagline' );
}Al posto di “slugtema” lo slug del tuo tema
-
20 Dicembre 2016 alle 7:58 #121127stenojazzyPartecipante
Grazie mille.
Ora faccio qualche prova e poi ti dico se sono riuscito nell’intento.
Grazie ancora
-
20 Dicembre 2016 alle 8:17 #121128stenojazzyPartecipante
Ho provato ma purtroppo non funziona.
Sicuramente sto sbagliando io qualcosa.
A tal proposito ti faccio un paio di domande (forse un po’ stupide):
1) dove devo copiare la funzione che mi hai scritto? o devo creare un file (se questo, come devo fare?)?
2) forse sbaglio lo Slug del tema…..dove lo trovo?
Ti ringrazio molto
-
20 Dicembre 2016 alle 10:42 #121130TittiModeratore
Scusa ma cosa intendi quando dici d’aver provato se poi chiedi dove va messa?
Non ho idea di cosa tu abbia provato a questo punto, la funzione va nel functions.php del child theme che stai usando.
Se la tua intenzione è quella di modificare un tema originale… è sbagliata, devi prima creare un child theme e poi fare tutte le modifiche là¬.
Lo slug del tema è il nome del tema corrente in formato semplice, cioè una parola in minuscolo che identifichi il tuo tema, il suo nome, ma non è importante e certamente non influisce sul funzionamento. Serve per identificazione, puoi metterci anche pippo o lasciarci slugtema se preferisci, l’importante è che il nome sia ripetuto uguale.
Per chiarezza bisognerebbe sempre dire lo scopo finale, non tenere oscuro il motivo per cui si vogliono ottenere certe cose.
àˆ per un sito personale? Non è il caso. Per gli utenti iscritti al tuo sito? Non ce n’è bisogno se sono da editor in giù.
àˆ un lavoro conto terzi, cioè un sito che stai facendo a pagamento per altri? Allora non farlo, lascia il lavoro a chi lo sa fare, non hai basi sufficienti e chi ci va di mezzo è il tuo eventuale cliente.
-
20 Dicembre 2016 alle 14:12 #121131stenojazzyPartecipante
Scusami,
non volevo certo accendere una discussione nè una polemica, ho chiesto un aiuto con umiltà ma visto il tono della risposta mi guarderò bene dal chiedere ancora in futuro, non vorrei mai urtare la vostra delicata sensibilità .
Avevo provato a copiare la funzione nel function.php ma del tema principale e non nel child, non lo sapevo.
Sto studiando per mia cultura e interesse personale, quindi ti tranquillizzo, non mi inventerei mai di “vendere” qualcosa di cui so poco…era solo una curiosità di “studio”.
Ti ringrazio comunque per la tua disponibilità e per le informazioni che mi hai dato e scusami ancora se non sono stato sufficientemente accorto.
Stefano
-
20 Dicembre 2016 alle 14:59 #121132TittiModeratore
Bene, se è solo uno studio allora ti ho dato la risposta e gli elementi per approfondire. La funzione è corretta, ti ho dato la risposta che cercavi e ti ho detto come fare. A quella puoi aggiungere le altre cose che vuoi, facendo come ti ho detto sopra. Se hai bisogno puoi chiedere ancora, ma il materiale di studio intanto ce l’hai, se invece preferisci di no, OK.
Non ho capito perché te la prendi se il tuo, come dici, non è il millesimo caso di uno che s’improvvisa a creare siti a pagamento facendo danni. Tu non sai quanti ce ne sono, io sà¬, altrimenti non l’avrei detto.
-
20 Dicembre 2016 alle 15:38 #121133stenojazzyPartecipante
Perchè nella mia vita ho imparato a chiedere delucidazioni prima di attaccare.
Ma comunque sei stata cortese a darmi le tue preziose indicazioni e quindi ti sono riconoscente. Non me la sono presa, ma ho trovato eccessivo il tuo attacco prima di sapere a cosa mi potessero servire le indicazioni richieste….infondo semplicemente io non sapevo di dover avere tutte queste “pre-attenzioni” visto che avevo avvisato che ero un neo iscritto al Forum.
Comunque direi che ci siamo più che abbondantemente chiariti, quindi per me è pace fatta e ti sono grato per la disponibilità che mi hai riservato.
Buone feste
Stefano
-
21 Dicembre 2016 alle 18:10 #121136TittiModeratore
Prego. Non c’era nessuna guerra in corso, non certo da parte mia. Il problema di molti è che non sanno accettare parole franche.
Le delucidazioni te le ho chieste nella mia prima risposta, e anche nella terza, rileggi. Non attaccando, ma facendo tre domande proprio per capire lo scenario.
Neo iscritto o no, ogni topic è a sé e occorre mettere con chiarezza le informazioni necessarie, o quelle richieste, ogni volta.
Adesso però non ribattere di nuovo, a meno che non sia esclusivamente relativo al problema, altrimenti chiudo il topic.
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.