Home › Forum › Problemi Vari con WP › WordPress: box news su sito
-
AutorePost
-
-
22 Maggio 2007 alle 7:04 #3804enrywebitPartecipante
Salve a tutti,
sto realizzando un sito e come piattaforma per il blog ho deciso di appoggiarmi a WordPress con cui mi trovo bene…
…vengo subito al succo e vi espongo il mio problema:
Mi sapete dire se è possibile creare un BOX con gli ultimi titoli dei post che ho scritto e inserirlo in uno spazio del sito???
Perchè so che è possibile avere un box con gli utlimi post scritti all’interno del blog stesso ma se volessi mettere questo BOX nella mia HomePage del sito sapete dirmi se è possibile???
P.S: Il codice usato nel blog è il seguente:
<?php get_archives(‘postbypost’, 10); ?>
E in questo modo mi mostra i titoli deli ultimi 10 articoli, però funziona solo all’interno del blog che è stato installato e caricato dentro una cartella BLOG.
Grazie a tutti
-
22 Maggio 2007 alle 9:00 #44744ondapiPartecipante
è possibilissimo inserire i titoli dei post di un blog all’interno di un altro sito, devi creare uno script che ti estrae gli ultimi post dal database
-
22 Maggio 2007 alle 9:23 #44746ondapiPartecipante
<?php
$db= @mysql_connect('localhost','utente','password');
mysql_select_db('nomedatabase' , $db);
$con = mysql_connect("localhost","utente","password");
$sel_db = mysql_select_db("nomedatabase", $con);
$result = mysql_query("select * FROM wp_posts ORDER BY id desc limit 10" ,$db);
while ($records = mysql_fetch_assoc($result)) {
echo $records['post_title'] ."<br>";
}
?>
questo dovrebbe fare al caso tuo, devi aggiornare i dati di connessione
-
22 Maggio 2007 alle 9:41 #44747ondapiPartecipante
puoi aggiungere il link diretto alla pagina del post sostituendo
la riga che inizia con echo con questo
echo "<a href=http://localhost/diariodireparto/index.php?p=". $records['ID'] .">". $records['post_title'] ."</a><br>";
lo script ti elenca non solo i post ma anche eventuali pagine o altro che abbia un “ID” in wp-posts
allora puoi selezionare solo i post sostituendo la sesta riga dello script con:
$result = mysql_query("select * FROM wp_posts WHERE post_type ='post' ORDER BY id desc limit 10 " ,$db);
dove post indica gli articoli di wp, se metti page ti elenca le pagine,
invece ti lascio indovinare a cosa serve limit 10
forse qui trovi qualcos’altro di interessante
ciao
-
23 Maggio 2007 alle 6:46 #44760enrywebitPartecipante
GENIALE GRAZIE MILLE SEI STATO GENTILISSIMO E MOLTO ESAURIENTE
GRAZIE ANCORA PER L’AIUTO
-
3 Novembre 2007 alle 20:43 #47720ondapiPartecipante
aggiusto il codice
localhost/diariodireparto è il percorso del mio blog locale che deve essere sostituito con il nome del sito fino alla cartella dove è ospitato il blog
-
14 Gennaio 2009 alle 17:29 #61252AnticalPartecipante
Scusate, sono nuovissimo (appena inscritto al forum).
Avrei lo stesso problema , ho provato a fare quanto descritto qui, ma non ci ho capito niente.
vado in ordine:
1- scrivo il codice:
<?php
$db= @mysql_connect(‘localhost’,’utente’,’password’);
mysql_select_db(‘nomedatabase’ , $db);
$con = mysql_connect(“localhost”,”utente”,”password”);
$sel_db = mysql_select_db(“nomedatabase”, $con);
$result = mysql_query(“select * FROM wp_posts ORDER BY id desc limit 10” ,$db);
while ($records = mysql_fetch_assoc($result)) {
echo $records .”<br>”;
}
?>
apportando le modifice fra gli apici ‘ ‘
Copio tutto sull’html dell’index del sito?
Se no.. dove?
Io ho fatto cosà¬, ma mi ritrovo ad avere visualizzati
}
?>
dove sbaglio?
Avrei la necessità di visualizzare sulla homepage del sito
http://www.antical.org (in html)
Un box con gli ultimi post del blog (messo su : http://www.antical.org/Blog
Mi potreste dare una mano??
Grazie infinite a chi mi risponde!!!
-
14 Gennaio 2009 alle 17:50 #61253SteveAglAmministratore del forum
Se vuoi farlo in un file HTML semplicemente NON puoi…
-
14 Gennaio 2009 alle 18:00 #61254AnticalPartecipante
Grazie Per la tempestiva risposta, quindi non c’è nessun script in javascript per farlo?
Grazie ancora
-
14 Gennaio 2009 alle 18:04 #61256SteveAglAmministratore del forum
A dire il vero non ne ho proprio idea… fare la pagina in PHP no eh?
-
14 Gennaio 2009 alle 18:30 #61259AnticalPartecipante
eheheheheheh!!!
A sapere come si fa!!!
-
14 Gennaio 2009 alle 19:12 #61263SteveAglAmministratore del forum
Esistono professionisti che possono farlo facilmente a buon prezzo
-
14 Gennaio 2009 alle 19:20 #61264AnticalPartecipante
Girellando sul web, ho trovato Wigitize… che trasmormava i post in codice html, però non funge più!!!
Avrei risolto!!!
-
21 Febbraio 2009 alle 19:20 #62983adlimenPartecipante
Il mio problema è simile e posto quଠsenza aprire una nuova discussione.
Avere i post sulla home del sito web esterna alla cartella del Blog
Avendo due installazioni di WP su due database, e volendo inserire nella home i post di entrambi vedo solo i post di una installazione.
Es: utilizzo questo script
<? require('Webnews/wp-blog-header.php');?>
<? query_posts("cat=4&showposts=2"); ?>
<?php while (have_posts()) : the_post(); ?>
<h3>" rel="bookmark"><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
<?php endwhile ?>
se inizio con: <?require('indirizzo 1° blog/wp-blog-header.php');?> e dopo in un altro punto della pagina metto: <?require('indirizzo 2° blog/wp-blog-header.php');?> vedo sempre in tutti e due i post del 1°.
Non capisco cosa devo fare.
Grazie
-
2 Luglio 2009 alle 6:27 #66828salentonetPartecipante
Ciao a tutti,
vorrei creare un box degli ultimi articoli per il mio blog di news sul Salento, da inserire su altri siti, a chi ne fa richiesta.
Mi potete indicare come fare?
-
2 Luglio 2009 alle 6:49 #66829SteveAglAmministratore del forum
Leggere l’intera discussione pare brutto? visto che li ci sono già le risposte
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.