Home › Forum › WP e Accessibilità › Pagina con testo e poi i post
-
AutorePost
-
-
17 Luglio 2008 alle 12:21 #7319WebmastroPartecipante
Ciao a tutti, avrei la necessità di creare una pagina cosଠstrutturata:
– testo sempre uguale –
– gli articoli aggiornati –
praticamene una pagina dove all’inizio ho del testo da me preparato, proprio come una pagina normale e poi sotto tutti i post relativi ad una categoria.
come posso fare?
-
17 Luglio 2008 alle 15:53 #55998SteveAglAmministratore del forum
Leggere sul wiki Usare le Pagine e gerarchia dei template, basta creare una template di pagina che abbia il testo che vuoi e poi Il Loop ed usare quel modello per uan pagina che scriverai con testo vuoto (solo titolo). Se no prendi il tuo tema e alla index.php aggiungi prima del Loop (sul wiki torvi che cosa è il loop) metti il testo che vuoi, ma se il tema usa la index .php anche per altre cose.
-
17 Luglio 2008 alle 22:31 #56032WebmastroPartecipante
il template per questa pagina lo creo partendo dal template attuale?
chiedo scusa ma l’aspetto puramente “creativo” dal punto di vista del codice pure mi è totalmente oscuro. onestamente mi sono messo qui 4 ore e più leggendo la wiki e onestamente non ci ho capito mezza… sarà un mio limite ma penso che bisogna saperne di PHP prima di mettersi a sperimentare.
purtroppo non riesco a capire da dove partire!
-
18 Luglio 2008 alle 0:29 #56034ondapiPartecipante
utilizzo un template che di pagina che fa proprio al caso tuo
ne avevo parlato per altri motivi qui http://www.wpitaly.it/forum/topic/7206
-
18 Luglio 2008 alle 5:35 #56035WebmastroPartecipante
vuoi mettere nel tuo template il contenuto di una pagina statica seguito dai tuoi articoli?
<?php query_posts(‘page_id=xx’); while (have_posts()) : the_post(); ?>
<?php the_content(); ?><?php endwhile; ?>
per stampare la pagina dove xx va sostituito con l’id
<?php query_posts(‘showposts=6’); while (have_posts()) : the_post(); ?>
<?php the_title(); ?><?php the_excerpt(); ?><?php endwhile; ?>
showposts=6 mostra i primi 6 articoli di tutte le categoria
showposts=4&cat=3 mostra i 4 articoli della categoria 3
<?php the_title(); ?><?php the_excerpt(); ?> andranno rispettivamente formattati
perfetto, è quello che voglio fare. a questo punto dove metto il codice? vado nella cartella del theme e poi? (dai che ce la faccio…)
anzi, ho cpaito che bisogna andare a modificare il file page.php facendone una copia in page-1.php e poi modificarlo. come faccio poi a far capire che quella determinata pagina deve caricare quel file pagina-1.php?
-
18 Luglio 2008 alle 11:12 #56052ondapiPartecipante
devi creare un template di pagina nuovo da asseganre ad una pagina specifica
per creare un template su wp non è difficile, cerca nel wiki o fai un cerca su google
-
18 Luglio 2008 alle 13:14 #56056WebmastroPartecipante
ok, sto cominciando a capire un po’ di cosette…
però ho difficoltà nell’inserire il codice, nel senso che mi da errore.
il codice in questione è il seguente:
<?php /* Template Name: Ascolta */ ?>
<?php get_header(); ?>
<div id=”content”>
<?php if (have_posts(‘page_id=12)) : while (have_posts()) : the_post(); ?>
<div class=”post” id=”post-<?php the_ID(); ?>”>
<h2><?php the_title(); ?></h2>
<div class=”post-content”>
<?php the_content(‘<p class=”serif”>Read the rest of this page »</p>’); ?>
<?php link_pages(‘<p>Pages: ‘, ‘</p>’, ‘number’); ?>
</div>
</div>
<?php endwhile; endif; ?>
</div><!–/content –>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
non è che mi potresti dire dove inserire per bene il codice?
grazie
-
18 Luglio 2008 alle 14:50 #56058SteveAglAmministratore del forum
L’ho ripetuto sino alla noia: DIRE DA’ ERRORRE NON SERVE A NIENTE, si fa tanta fatica a scrivere pure che errore da?
-
18 Luglio 2008 alle 19:33 #56075ondapiPartecipante
prova a mettere il codice suggerito tra il div content
eliminando il resto
ovviamente ti restitiirà un html scarno e anonimo
ci dovrai lavorare un po’ su inserendo i link ai post il navigatore e formattando qua e la
ti conviene osservare il codice di index o page php e provare a leggere il loop nel wiki
<?php query_posts('page_id=xx'); while (have_posts()) : the_post(); ?>
<?php the_content(); ?><?php endwhile; ?>
ogni stringa e di per se un loop autonomo ha solo bisogno di formattazione
se lo impili più volte in un template cambiando l'id ti stampa il contenuto delle pagine
se aggiungi the_title ti genera il titolo della pagina se modifichei the_content in the_excertp prova indovinare che succede...
la soluzione più semplice per me è quella di mandarti per mail un template già pronto o di stamparlo qua sotto, ma credimi ti conviene perdere qualche giorno a capirne il meccanismo altrimenti per ogni minima modifica dovrai dannarti
ciao
-
19 Luglio 2008 alle 10:27 #56084WebmastroPartecipante
L’ho ripetuto sino alla noia: DIRE DA’ ERRORRE NON SERVE A NIENTE, si fa tanta fatica a scrivere pure che errore da?
hai ragione, mia mancanza. mi diceva che c’è un errore di sintassi nella riga 11.
allo stesso modo dire di cercare su google premetto, ringrazio chi mi ha risposto, sia ben chiaro!
il fatto è che spesso quando si frequenta una wikik/blog/forum per molto tempo, si da per scontato che chi pone delle domande sia a conoscenza di molte cose.
la soluzione più semplice per me è quella di mandarti per mail un template già pronto o di stamparlo qua sotto, ma credimi ti conviene perdere qualche giorno a capirne il meccanismo altrimenti per ogni minima modifica dovrai dannarti
parole sagge, insegnali a pescare…
guarda, purtroppo il tempo è quello che è tra lavoro e bambini… se mi potessi inviare il file che poi me lo guardo bene. mi faresti un favorone. webmaster at radionk.com
grazie a tutti.
-
20 Luglio 2008 alle 8:53 #56110WebmastroPartecipante
<?php /* Template Name: Ascolta */ ?>
<?php get_header(); ?>
<div id=”content”>
<?php if (have_posts(‘page_id=12)); while (have_posts()) : the_post(); ?>
<div class=”post” id=”post-<?php the_ID(); ?>
<?php query_posts(‘showposts=10&cat=6’); while (have_posts()) : the_post(); ?>
<?php the_title(); ?><?php the_excerpt(); ?><?php endwhile; ?>
<h2><?php the_title(); ?></h2>
<div class=”post-content”>
<?php the_content(); ?>
</div>
</div>
<?php endwhile; ?>
</div><!–/content –>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
mi da il seguente errore:
Parse error: syntax error, unexpected T_STRING in …/page_asc.php on line 6
mi sa che vengono ripetute alcune cose e forse non ne vengono chiuse altre…
-
20 Luglio 2008 alle 9:09 #56114SteveAglAmministratore del forum
qui:
<div class=”post” id=”post-<?php the_ID(); ?>
mancano gli ” di chiusura sul parametro id.
-
20 Luglio 2008 alle 9:56 #56116WebmastroPartecipante
<?php /* Template Name: Ascolta */ ?>
<?php get_header(); ?>
<div id=”content”>
<?php if (have_posts(‘page_id=12)); while (have_posts()) : the_post(); ?>
<div class=”post” id=”post-<?php the_ID(); ?>”>
<?php query_posts(‘showposts=10&cat=6’); while (have_posts()) : the_post(); ?>
<?php the_title(); ?><?php the_excerpt(); ?><?php endwhile; ?>
<h2><?php the_title(); ?></h2>
<div class=”post-content”>
<?php the_content(); ?>
</div>
</div>
<?php endwhile; ?>
</div><!–/content –>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
corretto ma rimane l’errore:
Parse error: syntax error, unexpected T_STRING in …/page_asc.php on line 6
[COMUNICAZIONE DI UN MODERATORE: AL PROSSIMO UP, COSA CONTRARIA ALLA POLICY DEL FORUM,SCATTA IL BAN INVECE CHE LA CANCELLAZIONE DELL UP, UP E’ ANCHE TUA EVENTUALE RISPOSTA NON LO SAPEVO, SCUSATE, HO BISOGNO D’AIUTO ETC. SE DEVI COMUNICARE PER QUESTO C’E’ IL MODULO CONTATTI]
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.