Home › Forum › Problemi Vari con WP › older/recent posts non funziona!
-
AutorePost
-
-
2 Maggio 2013 alle 13:57 #24490AnuPartecipante
Salve a tutti, ho creato il loop dentro a category.php, tuttavia ho fissato che si vedesse solo la categoria numero 1 e per ogni pagina ci fossero 3 post (in grassetto il query_posts).
Tuttavia non funzionano il link che porta alla pagina dei post più vecchi/recenti (una volta superato i 3 posts della prima pagina), dandomi l’errore 404 (pagina not found).
Se invece creo lo stesso loop dentro ad una pagina (creo il template per la pagina), il link funzionano però nell’elenco si vedono sempre gli stessi posts..
Se invece tolgo via la stringa in grassetto e definisco il limite di visualizzazione dall’impostazione, funziona tutto correttamente.
<ul id="list_news_eventi">
<?php query_posts('posts_per_page=3&cat=1'); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); // se sono presenti post mostrali ?>
<!-- inizio elenco post -->
<p class="title">" title="<?php the_title(); ?>"><?php the_title(); ?></p>
<?php $contenuto = get_the_excerpt(); //taglio automatico ?>
<?php echo $contenuto ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
<div class="post-nav">
<span class="prev"><?php next_posts_link(__('« Older Entries', 'themify')) ?></span>
<span class="next"><?php previous_posts_link(__('Newer Entries »', 'themify')) ?></span>
</div> -
2 Maggio 2013 alle 14:27 #103334wollyAmministratore del forum
-
2 Maggio 2013 alle 14:32 #103336elmaniseroPartecipante
Prova cosà¬
<?php
$args = array(
‘cat’ => ‘1’,
‘post_type’ => ‘post’,
‘posts_per_page’ => 3,
‘paged’ => ( get_query_var(‘paged’) ? get_query_var(‘paged’) : 1),
);
query_posts($args);
if (have_posts()) : while (have_posts()) : the_post();?>
<ul id=”list_news_eventi”>
- <!– inizio elenco post –>
<p class=”title”>” title=”<?php the_title(); ?>”><?php the_title(); ?></p> <?php $contenuto = get_the_excerpt(); //taglio automatico ?> <?php echo $contenuto ?>
<?php endwhile; endif; ?>
<div class=”post-nav”>
<span class=”prev”><?php next_posts_link(__(‘« Older Entries’, ‘themify’)) ?></span>
<span class=”next”><?php previous_posts_link(__(‘Newer Entries »’, ‘themify’)) ?></span>
</div>
- <!– inizio elenco post –>
-
7 Maggio 2013 alle 9:29 #103411AnuPartecipante
Grazie per le risposte, devo ancora testarli, vi farò sapere se e quale funziona
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.