Home › Forum › Problemi Vari con WP › Mostrare tutti i post in archive.php
-
AutorePost
-
-
27 Febbraio 2008 alle 22:00 #5936u2t4c6s8nPartecipante
Salve, vorrei che il mio archive.php mostrasse tutti i post a prescindere dalla categoria scelta. Purtroppo il numero dei post viene limitato secondo le opzioni del blog. Perché posts_per_page non funge?
<?php
get_header();
global $wp_query;
$wp_query->set(‘posts_per_page’, -1);
while ($wp_query->have_posts()) : $wp_query->the_post();
echo “<p>”.the_title().” – “.the_excerpt().”</p>”;
endwhile;
get_sidebar();
get_footer();
?>
-
28 Febbraio 2008 alle 7:20 #51139SteveAglAmministratore del forum
Ti è stato già risposto in altro thread!
-
28 Febbraio 2008 alle 8:07 #51140SteveAglAmministratore del forum
Ah no sorry… ti ho già risposto su it.comp.www.php
NOTA SPAZI AGGIUNTI PER MOSTRARE ILC ODICE E NON FARLO INTERPRETARE
< ? php
get_header();
// retrieve all post
query_posts(”posts_per_page=-1′);
// the Loop
while (have_posts()) : the_post();
“< p>”.the_title().” – “.the_excerpt().”< /p>”;
endwhile;
get_sidebar();
get_footer();
? >
Questo dovrebbe andare…
-
28 Febbraio 2008 alle 14:07 #51163u2t4c6s8nPartecipante
Il problema non è risolto, come è vero che la direttiva query_posts(‘posts_per_page=-1’);
fa il suo dovere è anche vero che tutti i restanti criteri vengono azzerati e vengono mostrati tutti ma proprio tutti i post.
Mi sono senz’altro espresso male invece di
tutti i post a prescindere dalla categoria scelta
sarebbe stato più corretto dire
tutti i post della categoria scelta
grazie per le risposte temo che non ci siano soluzioni comode al problema
-
28 Febbraio 2008 alle 15:54 #51171SteveAglAmministratore del forum
Ah ecco, vuoi mantenera la query generata da WP e cambiare solo qualche parametro, inq uesto caso usa questa:
<?php query_posts($query_string . ‘&posts_per_page=-1’); ?>
Testata e funzionante.
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.