Home › Forum › Problemi Vari con WP › Inserire articoli di una sola categoria in Home Page
-
AutorePost
-
-
18 Dicembre 2009 alle 11:35 #12472rosariodamorePartecipante
Ciao a Tutti,
ho bisogno di inserire articoli di una sola categoria nella home page del mio blog wordpress mentre gli articoli delle altre categorie verranno letti cliccando sul link della categoria corrispondente in un widget.
Come posso inserire gli articoli (post) di una sola categoria nella home page del sito? Devo modificare la index.php?
Mi date una mano?
Grazie 10^3
-
18 Dicembre 2009 alle 12:18 #70141alessandro308Partecipante
non ho capito, te devi avere solo una categoria in home o che cosa?
-
18 Dicembre 2009 alle 14:54 #70148rosariodamorePartecipante
si una sola categoria in home
-
18 Dicembre 2009 alle 16:30 #70156
-
18 Dicembre 2009 alle 20:52 #70160rosariodamorePartecipante
Ok Grazie,
ma non vorrei sbagliare quindi nel mio index.php al posto di <?php while (have_posts()) : the_post(); ?> devo inserire:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
e
<?php if ( in_category(‘3’) ) { ?>
<div class=”post-cat-three”>
<?php } else { ?>
<div class=”post”>
<?php } ?>
?
-
19 Dicembre 2009 alle 17:19 #70177silvanaPartecipante
io uso il plugin Advanced Category Excluder
-
24 Dicembre 2009 alle 12:01 #70249alessandro308Partecipante
basta che vai su lettura e imposti n home una sola categoria!
-
27 Dicembre 2009 alle 18:00 #70308rosariodamorePartecipante
non esiste un’opzione del genere! Come faccio?
-
27 Dicembre 2009 alle 18:25 #70309rosariodamorePartecipante
Ho installato Advanced Category Excluder e ha risolto tutto.
Silvana sei grande.
Ciao a tutti
-
29 Dicembre 2009 alle 16:27 #70342gollum1Partecipante
puoi anche semplicemente far precedere il loop dalla funzione query_post(), dove indichi che vuoi visualizzare i post di una particolare categoria, senza uso di plugin.
Google:
codex.wordpress.org category post
Primo e secondo link:
ttp://codex.wordpress.org/The_Loop
http://codex.wordpress.org/The_Loop_in_Action
trovi info molto interessanti per il tuo problema,
se poi aggiungi query_post invece di post a google ottieni il seguente link:
http://codex.wordpress.org/Template_Tags/query_posts
Show One Category by Name
Display posts from only one category by name:
query_posts('category_name=Staff Home');
per essere più corretto dovresti mettere:
query_posts($query_string . 'category_name=Staff Home');
Byez
--
Gollum1
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.