Home › Forum › Problemi Vari con WP › the_excerpt() , the_content per ridure il testo
-
AutorePost
-
-
23 Aprile 2007 alle 12:21 #3634vinarcid0810Partecipante
Ciao a tutti
sono nuovo del forum ed idem con wp …
nella mia index del template ho creato un annuncio tramite il plugin announcement
http://www.lesterchan.net/wordpress/2007/03/02/this-is-an-announcement/
ora ho l esigenza di mettere nella home gli ultimi 10 titoli degli articoli acconpagnati da un riassunto (messo in automatico o quello scritto dall’autore)
Dalle faq ho trovato l’opzione del tag the_excerpt() ma questa modifica non fa per me, visto che mi va a ridurre anche il post announcement che invece dovrebbe visualizzarsi per intero.
spero di essere stato chiaro e che sia possibile apportare questa modifica … altrimenti dovo cambiare piattaforma .
ps. ecco un link dove si trova quello che vorrei realizzare http://www.articolista.com/
-
23 Aprile 2007 alle 12:51 #44410
-
23 Aprile 2007 alle 14:07 #44414vinarcid0810Partecipante
si è proprio quello che fa per me … ma ho problemi nella configurazione .. saresti cosi gentile da darmi una mano ???
allora ho modificato il codice della pagina index.php
da:
<?php if (is_search()) { ?>
<?php the_excerpt() ?>
<?php } else { ?>
<?php the_content(__('Continua a leggere...')); ?>
<?php } ?>
a:
<?php
if (have_posts()) :
$nr_post = 0;
while (have_posts()) : the_post();
// titolo e robe varie
if ($nr_post == 1 ) { // se è il primo post metti il content
the_content();
} else {
the_excerpt();
}
$nr_post ++;
endwhile;
endif;
?>
ma il risultato è che mi crea un casino di post tutte con lo stesso contenuto e titolo… cosa sbaglio???
-
23 Aprile 2007 alle 15:45 #44419wollyAmministratore del forum
non so se sono in grado di aiutarti, hai letto anche lapagina nel wiki ?
ciao
wolly
-
23 Aprile 2007 alle 18:11 #44432wollyAmministratore del forum
io l’ho provato e funziona ho modificato la prima linea mettendo $nr_post = 1 (perchè mi sembra di capire,non sono un esperto di php) che il primo post sarebbe il zero con quello scritto nella formula e forse è quello che ti creava problemi.
Poi se vuoi che ci sia solo nell home page , forse , bisognerebbe aggiungere anche il comando is-home ma qui , spero, ti aiuterà Mr brown che è molto più esperto di me.
ciao
wolly
-
24 Aprile 2007 alle 7:36 #44437vinarcid0810Partecipante
ok ho risolto in parte …
ho messo questo codice:
<?php
if ($nr_post == 1 ) { // se è il primo post metti il content
the_content();
} else {
the_excerpt_reloaded(20, ‘‘, ‘content_rss’, TRUE, ‘Continua >>’, FALSE, 2);
}
$nr_post ++;
?>
dove the_excerpt_reloaded è un plugin che permette di configurare come visualizzare il riassunto …..
ora però vorrei che quando si va nella categoria che tutti gli articoli siano configurati con the_excerpt_reloaded (invece il primo esce intero gli altri no)…
ho visto il wiki ma non sono molto afferato con php
-
24 Aprile 2007 alle 8:44 #44439vinarcid0810Partecipante
ci sono quasi … ragazzi una mano ..
<?php
if (is_home() && $nr_post == 1 ) { // se è il primo post metti il content
the_content();
} elseif (is_category() || is_archive()) {
the_excerpt_reloaded(20, '<img>', 'content_rss', TRUE, 'Continua >>', FALSE, 2);
}
$nr_post ++;
?>
con questo nelle categorie ho tutti gli articoli con riassunto … ma nella home non mi compare il riassunto degli articoli…..
-
28 Aprile 2007 alle 7:25 #44468chit67Partecipante
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.