Bunu basit bir sekilde yapabilirsin.
Resimli olarak cekmek için iki adet dosya gereklidir..
Birincisi veritabanı ayarlarının oldugu dosya. ikincisi ise kodları yazdıgın dosya.
ayar dosyası:
<?
$dbhost="localhost";
$dbname="veritabanı adı";
$dbsifre="veritabanı sifre";
$dbuname="veritabanı kullanıcı adı";
mysql_connect("$dbhost","$dbuname","$dbsifre")or die(mysql_error());
mysql_select_db("$dbname");
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET 'utf8_general_ci'");
mysql_query("COLLATE 'utf8_general_ci'");
?>
sitene koyacagın kod:
<?php
include("ayar.php");
?>
<?php $sonuclar = mysql_query("SELECT posts.ID, posts.post_title AS title, posts.post_content AS content, files.meta_value AS filepath FROM wp_posts posts INNER JOIN wp_posts attachments ON posts.ID = attachments.post_parent INNER JOIN wp_postmeta files ON attachments.ID = files.post_id WHERE files.meta_key = '_wp_attached_file' order by id desc limit 10");
while($row=mysql_fetch_array($sonuclar)) {
$resim = 'http://siteninadresi/wp-content/uploads/' . $row[filepath];
$baslik = $row[content];
$sayi = '?p=' . $row[ID];
?>
<div>
<a href="http://siteninadresi/<?php echo $sayi; ?>" target="_blank"><img src="<?php echo $resim; ?>" /></a>
<br />
<div class="baslik">
<span><a href="http://siteninadresi/<?php echo $sayi; ?>" target="_blank"><?php echo $baslik; ?></a>
</span>
</div>
</div>
<? } ?>
Kodları koyacagın dosya html değil php uzantılı olmalıdır.
Yoksa çalışmaz.