Home › Forum › Problemi Vari con WP › condizione if sui tag
-
AutorePost
-
-
13 Marzo 2008 alle 11:57 #6023TremisferoPartecipante
Ciao tutti. Vorrei che gli amministratori del mio sito possano marchiare con etichette del tipo “speciale” gli articoli inseriti.
Non so se WP è predisposto per fare ciò ma ho pensato che forse si potrebbe ottenere questo risultato inserendo, al momento della pubblicazione, in tutti gli articoli speciali il tag “speciale” e poi porre un if nell’estrazione da query degli articoli che controlli se c’è o no questo tag associato all’articolo. Nel caso ci sia lo espliciti nella formattazione con un testo o un’immagine in più.
La domanda è: come faccio un if che controlli se un determinato tag è associato ad un articolo?
Spero sia fattibile!
-
13 Marzo 2008 alle 12:17 #51528wollyAmministratore del forum
perchè non usare una categoria “speciale” ?
nelle faq e nel forum trovi diverse implementazione del if con le categorie.
-
13 Marzo 2008 alle 15:00 #51536SteveAglAmministratore del forum
Volendo farlo coi tag occorre usare i tag condizionali appositi per i tags info sulla pagina in inglese qui sotto (NON è STATA AGGIORNATA ANCORA QUELLA ITALIANA)
-
13 Marzo 2008 alle 15:28 #51537TremisferoPartecipante
Grazie Spero funzioni.
-
17 Marzo 2008 alle 20:34 #51611TremisferoPartecipante
Purtroppo ho provato ad usare questo if
<?php if(is_tag(‘speciale’)) : ?>
ma non viene rispettato. Se lo applico ad un articolo che contiene il tag ‘speciale’ non va.
Ma infatti mi pare di aver capito dalla guida inglese che questo if non fa al caso mio. Devo forse ricorrere a una query di puro php?
-
18 Marzo 2008 alle 7:18 #51618SteveAglAmministratore del forum
Effettivamente hai ragione, manca un tag in_tag omologo di in_category, la proporrò come miglioria per un futura versione di WP (non certo la 2.5)
-
18 Marzo 2008 alle 16:30 #51623TremisferoPartecipante
Urgh… vabè.
Grazie…
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.