Home › Forum › Problemi Vari con WP › dove sbaglio?wp_list_page
-
AutorePost
-
-
29 Agosto 2010 alle 20:31 #14880kikko088Partecipante
questa è la stringa, non mi visualizza niente…come mai secondo voi?
<?php wp_list_pages(‘title_li=&number=5&sort_column=time_created&sort_order=DESC’); ?>
secondo voi è possibile fare questo piccolo plugin?
prendere le ultime 5 pagine, gli ultimi 5 articoli, e fare una lista ordinata dall’ultimo articolo o post scritto fino al più vecchio (non due liste separata una sola lista con pagine e articoli mischiati) e associare a ogni articolo un’immagine?
per l’immagine non penso sia un problema perchè c’è la possibilità di inserire le thumb per ogni articolo/pagina quindi non mi preoccupa, per la lista invece devo lavorare ancora un pò…
kikko088
-
30 Agosto 2010 alle 16:52 #76711
-
1 Settembre 2010 alle 9:54 #76751kikko088Partecipante
proverò in questo modo ma dal codex wordpress.org mi pare che ci sia sia il sort_column che sort oredr http://codex.wordpress.org/Function_Reference/wp_list_pages
-
1 Settembre 2010 alle 10:17 #76756SteveAglAmministratore del forum
<?php wp_list_pages(‘number=5&sort_column=time_created&sort_order=DESC’&title_li=’); ?>
e cosi’ va?
-
1 Settembre 2010 alle 15:44 #76771kikko088Partecipante
mmm no, non funziona neanche cosi!però ho trovato l’errore, sort_column=time_created non è cosi ma cosi sort_column=post_date, ora funziona, posso chiedervi ancora un piccolo aiuto?c’è un modo per prendere tutte le ultime cose scritte (pagine e post) utilizzando il query_post?
kikko088
-
1 Settembre 2010 alle 16:03 #76772SteveAglAmministratore del forum
si e no.. non puoi avere un loop con tutto.. devi unire i riosultati a manina e ordinarli tu per data… PHP required
-
1 Settembre 2010 alle 16:08 #76773kikko088Partecipante
invece penso di aver risolto, volevo fare una modifica ad un plugin che mi facevo lo slide degli ultimi articoli di una categoria, guardando il codice e andando un po a naso ho fatto un due prove e usando query_posts(‘post_type=any’) sembra funzionare, se inserisco una pagina o un articolo me lo visualizza, quindi SEMBRA che sia tutto come volevo…
kikko088
-
1 Settembre 2010 alle 17:54 #76776reallocPartecipante
Penso che non hai risolto il problema … ‘any’ ti da per esempio anche tutto con il post_type ‘revision’.
-
1 Settembre 2010 alle 18:29 #76778SteveAglAmministratore del forum
Ah si che stupido mi ero scordato il l’opzione any per post_type perchè non la uso praticamente mai però effettivamente poi hai il problema che indica realloc però poi se mostri solo i tipi post e pages nessun problema solo che dei estranrre molti elementi per non avere appunto revisioni attacchment etc
-
1 Settembre 2010 alle 19:36 #76780kikko088Partecipante
mmm ora il problema è, come faccio ad usare post e page?
-
1 Settembre 2010 alle 20:12 #76782SteveAglAmministratore del forum
guardando il post type e stampando solo quelli di tipo post e page… ovviamente scrivendo il codice PHP dipende che devi fare esattamente…
-
1 Settembre 2010 alle 20:24 #76784kikko088Partecipante
sto modificando una piccola modifica ad un plugin, che fa la slide degli ultimi articoli, nel pannello di controllo scelgo categoria e numero di post e il plugin mi fa la slide, io voglio che faccia lo slide di tutto ciò che scrivo, la stringa da modificare è questa:
<?php query_posts(‘post_type=any’ . ‘&showposts=’ . get_option(‘slideshow-posts’)); ?>al posto del post type c’era l’opzione come per il numero di post.
vista la mia scarsa conoscenza di php stavo cercando di fare poche modifiche per non far danni…
guardando sul codex di wordpress però ho visto che le revisioni non vengono incluse
‘post_type’ => ‘page’ – returns Pages; defaults to value of post; can be any, attachment, page, post, or revision. any retrieves any type except revisions. Also can designate custom post types (e.g. movies).
gli attachment immagino che verranno visualizzati con la pagina giusto?quindi al massimo viene visualizzata la pagina in cui ho inserito l’allegato, il chè potrebbe andarmi bene…il ragionamento fila?
-
1 Settembre 2010 alle 21:36 #76787reallocPartecipante
Ma adesso parli di query_posts e non di wp_list_pages … con query_posts potrebbe andare
query_posts(
array(
'post_type' => array('post', 'page'),
'showposts' => get_option('slideshow-posts')
)
);
-
3 Settembre 2010 alle 17:37 #76861kikko088Partecipante
perfetto!grazie mille
kikko088
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.