Home › Forum › Problemi Vari con WP › Articoli categoria su pagina
-
AutorePost
-
-
31 Maggio 2008 alle 13:18 #6822BlaysPartecipante
Salve,
se ho creato una nuova pagina e volessi far visualizzare solo in quella pagina gli ultimi articoli di una determinata categoria, come potrei fare?
Ho provato con SH Category Archives, ma usando WP 2.3.3 il plugin non funziona.
Qualcuno può darmi un suggerimento?
Grazie
-
31 Maggio 2008 alle 14:49 #54186ArturoPartecipante
Allora ci sono alcuni passaggi da fare, te li illustro:
1- Apri un editor, crei una pagina bianca con estensione .php, tipo PaginaCat1.php
2- in questa pagina inserirai la parte di codice che ti incollo di seguito e da dove c’e’ il commento che ti dice di inserire le tue classi css lo fai in modo da utilizzare in modo corretto la grafica del tuo blog
il codice e’ il seguente:
<?php
/*
Template Name: Pagina Categoria 1
*/
?>
<?php get_header(); ?>
<!– da qui devi inserire le tue classi per richiamare la grafica –>
<?php $recent = new WP_Query(“cat=289&showposts=3”); while($recent->have_posts()) : $recent->the_post();?>
<h2>< a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></ a></h2>
<?php the_content(“Continua a leggere »”); ?>
<?php endwhile; ?>
<?php get_footer(); ?>
togli gli spazi a < a href… ed </ a>
3- puoi personalizzare il nome del template della pagina al posto di Pagina Categoria 1, metti quello che piu’ ti piace e si addice di piu’ al tipo di pagina
4- salvi il tutto e carichi con un client FTP la pagina nella cartella del tuo theme dove si trovano le altre pagine .php (header.php, index.php, footer.php ecc)
5- accedi a WP, vai nella sezione SCRIVI -> PAGINA, metti un titolo alla pagina scendi piu’ in basso e troverai tra i vari campi TEMPLATE PAGINA selezioni il template da te appena caricato via ftp e fai pubblica
6- hai finito ogni modifica da effettuare alla pagina fallo direttamente non usare l’editor di WP o sballerai tutto!
Enjoy!
-
31 Maggio 2008 alle 14:51 #54187ArturoPartecipante
ho dimenticato…
(“cat=289&showposts=3”);
lo devi personalizzare con l’ID della categoria che vuoi utilizzare, nell’esempio l’ID e’ 289 e il numero dei post che vuoi che escano 3, 4, 5 oppure cancelli da & e lasci solo cat=ID per mostrare tutti i post di quella data categoria.
-
31 Maggio 2008 alle 15:43 #54191BlaysPartecipante
Tutto spiegato perfettamente…però purtroppo nel campo TEMPLATE PAGINA non appare il mio nuovo template, che invece appare correttamente in Aspetto – Editor temi
Il mio tema è Cutline 3 column split
-
31 Maggio 2008 alle 15:45 #54192BlaysPartecipante
Ok, risolto grazie mille!
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.