Home › Forum › Problemi Vari con WP › Pagina con solo una categoria: non funzionano le pagine
-
AutorePost
-
-
27 Giugno 2013 alle 16:10 #24881bacoPartecipante
Salve ragazzi, ho creato una pagina dove visualizzare una sola categoria seguendo una procedura abbastanza semplice, creando una copia di index.php, rinominandola ed inserendoci dentro:
<?php
/*
Template Name: categoriax
*/
?>
e
<?php query_posts('cat=IDCATEGORIA'); ?>
La pagina funziona, visualizza solo la categoria da me scelta, il problema
è che non funzionano le pagine con articoli più vecchi, pagina 2, pagina 3 ecc.
es se vado su www.sito.com/categoriax/page2 trovo gli articoli di www.sito.com/categoriax
Spero possiate aiutarmi, a presto:) -
27 Giugno 2013 alle 18:12 #104199SteveAglAmministratore del forum
Ovviamente non hai cercato se no la tua domanda l’avresti rtrovata mille volta con la risposta comunque:
http://codex.wordpress.org/Function_Reference/query_posts#Preserving_Existing_Query_Parameters
Che ovviamente avresti dovuto leggerti prima di pasticciare con WP:
-
28 Giugno 2013 alle 11:03 #104221bacoPartecipante
Ciao Steve grazie per la risposta ma in realtà ieri avevo consultato proprio quella pagina prima di scrivere, solo che pensavo in inglese il mio problema avesse a che fare qualcosa con la Pagination che ti rimanda ad un’altra pagina ancora. Inoltre dopo aver letto tre-quattro guide tutte con stringhe alternative tutte funzionanti ma tutte con lo stesso problema pensavo ci fosse un problema da risolvere altrove.
Se dovesse servire per altri utenti ho risolto cosà¬:
<?php query_posts( array( 'cat' => IDCATEGORIA, 'paged' => get_query_var('paged') ) );
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
Mi chiedevo, l'inizio del mio loop di base è staccato:
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
Devo unirlo come riportato in quel link o le due stringhe sono equivalenti:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.