Visualizzazione 4 filoni di risposte
Visualizzazione 4 filoni di risposte
- Devi essere connesso per rispondere a questo topic.
Email: info@wpitaly.it
Home › Forum › Problemi Vari con WP › controllo titolo pagina per script php
Ciao a tutti,
devo riprodurre su wordpress il tema di questo sito: http://www.openpost.it
Come vedete, alle voci del menu in alto vengono date delle classi css differenti a seconda se siano selezionate o meno.
Per farlo, dovrei poter controllare il titolo della pagina attualmente caricata in modo da fare l’assegnazione. Quale funzione mi restituisce questo valore? the_title() lo stampa, ma non mi consente di usarlo in un controllo…
Grazie
Ho trovato la funzione “is_page” che fa al caso mio.
Tuttavia in questo modo renderei impossibile la modifica dell’ordine delle pagine senza mandare all’aria il template.
Mi potete suggerire come fare in modo che venga data una classe differente a seconda che la pagina sia la prima, la seconda e cosଠvia?
Grazie
Perchè rendi impossibile l’ordinamento delle pagine? Usi is_page(nome-della-pagina) quindi il suo permalink… altrimenti non ho capito cosa vuoi fare…
Appunto. Usando is_page, funzionerà solo ed esclusivamente con la pagina. Se il cliente decide di cambiare l’ordine delle pagine nel menù in alto, tutto il lavoro si rovinerà .
no perchè per ogni elemento tu sai che cosa mostri e quindi il suo slug associ a ciascono una condizione is_page(slug) che se vera mette la classe che serve se no altro o nulla et voilà …
WPItaly - Copyright Creative Commons: CC BY-NC-SA 4.0