Home › Forum › Problemi Vari con WP › query post
-
AutorePost
-
-
23 Ottobre 2009 alle 11:46 #11927MassimoVitaliPartecipante
è possibile escludere determinati post da determinate categorie?
non sono riuscito a trovare niente sul wiki
-
23 Ottobre 2009 alle 17:39 #68987ondapiPartecipante
cosa intendi da determinate categorie
se crei un archivio di categoria per intenderci category-5.php vedi gerarchia template
puoi escludere utilizzando query post alcune sottocategorie collegare alla categoria
<?php query_posts($query_string . "&cat=-6"); ?>
pertanto se dai una certa sottocategora alla categoria madre agli articoli che non vuoi stampare questi non saranno visualizzati negli archivi di categoria
per l'home page puoi usare questa faq
-
25 Ottobre 2009 alle 13:51 #69019MassimoVitaliPartecipante
volevo creare una categoria in cui comparisse solo un immagine grande quasi a tutto schermo, in cui non c’è la sidebar e sotto di essa si vedono i nomi delle sottocategorie senza i post di queste
ho creato questo codice per la categoria ma non mi si escludono dalla categoria i post delle sottocategoria.. vedi qua il codice : http://pastebin.com/m3a9b2a28
Come posso fare? aiutatemi vi prego..
GRAZIE
-
25 Ottobre 2009 alle 13:53 #69020MassimoVitaliPartecipante
“Se un articolo appartiene anche ad un’altra categoria, verrà comunque visualizzato.” leggo dal wiki.. è forse questo il motivo che non mi esclude i post delle sottocategorie? forse perchè appartengono indirettamente anche alla categoria stessa? si complica la faccenda?
-
25 Ottobre 2009 alle 18:55 #69028ondapiPartecipante
volevo creare una categoria…
puoi usare la gerarchi dei template category-5.php
in cui comparisse solo una immagine
essendo un template non devi far altro che inserirla nel file come codice html <img …
in cui non c’è la sidebar
togli il get_sidebar()
i nomi delle sottocategorie senza i post di queste
usa la funzione child_of di wp_list_cats e qui un esempio
il codice che hai postato funziona, però non sono inseriti i tag (marcatori di template) di titolo the_title(), link…, categorie…, ma solo il content the_content() per questo ti mostra solo i testi, inoltre si deve adattare al tema in uso tramite css se si toglie la sidebar
per il tema di default che hai postato vedi la differenza in div id=”content”
tra class=”narrowcolumn” e class=”widecolumn”
se creo una pagina di categoria madre mi pubblica anche le categorie figlie collegate anche se non hanno assegnate la categorie madri al post direttamente, che però si esclude con
$query_string . “&cat=-6”
-
25 Ottobre 2009 alle 21:34 #69030MassimoVitaliPartecipante
grazie ondapi per la risposta ma non ci siamo ancora.. allora prova a cliccare qui
potrai vedere prima delle immagini seguite dal testo e poi un altra immagine..
le immagini seguite dal testo corrispondono all’articolo della sottocategoria “camporgiano” quella di qui ho creato la categoria personalizzata “category-X” di qui ti ho dato il link con pastebin ( http://pastebin.com/m3a9b2a28 )
volutamente ho levato il titolo.. per una scelta di stile non per altri motivi, è sconveniente?
le sottocategorie sono gia visualizzate in automatico, quindi non ho bisogno della “sort of column”
parlando pero del mio problema.. il fatto è che devo trovare una query che inserita nel codice della category.php mi escluda gli articoli della sottocategoria “camporgiano”.
GRAZIE PER LA RISPOSTA ONDAPI.. attendo tue/vostre notizie
grazie ancora
-
26 Ottobre 2009 alle 20:43 #69060ondapiPartecipante
ma non funziona…
<?php query_posts($query_string . “&cat=-11”); ?>
nel senso che se la categoria 11 è una sottocategoria di 10 (diciamo)
nel file category-10.php non dovrei visualizzare richiamando la categoria 10 anche i post della sottocategoria 11
-
27 Ottobre 2009 alle 14:23 #69077MassimoVitaliPartecipante
ciao ondapi, eccoci di nuovo.. allora ecco il codice della category-1.php (http://pastebin.com/m5aa948) che corrisponde a quella principale (“Fotogallery…”).. qui dico di escludere la categoria 11 (la sottocategoria “Camporgiano”)..
ma non vedo risultati perchè?
ps ho creato in precedenza una category-11.php in cui non metto visibile il titolo.. c’entra qualcosa?
aspetto un’altra tua gentile risposta.. grazie
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.