ผมจะดึงรูปจาก database ออกมายังไงครับ wp

เริ่มโดย WP-design, 30 พฤศจิกายน 2013, 12:32:53

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

WP-design

ใครเคยดึงรูปจาก database wp ช่วยหน่อยครับไม่รู้ว่ารูปมันอยู่ตารางไหน ปกติ wp มันเก็บไว้ตรงไหน มือใหม่ครับ งงมาก :P ส่วนท่านที่จะบอกว่าทำไมไม่ใช้ code ที่เขามีมาให้เลย เช่น
<?php the_post_thumbnail('img'); ?> เพราะผมจะดึงจากดาต้าเบสของอีกเว็บมาใส่ครับ ส่วน title มาแล้วแต่อยากได้รุปด้วย ขอบคุณครับ :wanwan017:

<?php
    
//MySQL Username
    
$user "wordpress-database-username";
    
//MySQL Password
    
$pass "wordpress-databasepassword";
    
//MySQL Database Name
    
$database "wordpress-database-name";
    
//Number of posts you want to have appear
    
$numOfPosts 7;

    
//Setup connection
    
$mysqli = new mysqli("localhost"$user$pass$database);

    
/* check connection */
    
if (mysqli_connect_errno()) {
    
printf("Connect failed: %s\n"mysqli_connect_error());
    exit();
    }

    
$limit $numOfPosts;

    
$sql "SELECT * FROM wp_posts WHERE post_type = 'post' AND post_status IN ( 'draft', 'publish', 'future', 'pending', 'private' ) ORDER BY post_date DESC LIMIT $limit";
    
$result $mysqli->query($sql);

    while (
$row $result->fetch_object()) {
    echo 
'<ul>';
    echo 
'<li><a href="'.$row->guid.'">'.$row->post_title.'</a></li>';
    echo 
'</ul>';
    }
    
?>

xvlnw.com

Table: postmeta
field: meta_key  | value: _wp_attached_file
field: post_id | value : ID of post your want.
[direct=https://cloudhost.in.th/wordpress-hosting]ツ ⓌⓄⓇⒹⓅⓇⒺⓈⓈ ⒽⓄⓈⓉⒾⓃⒼ [/direct] :wanwan014:  :D
[direct=https://cloudhost.in.th/cloudhosting.html]Cloud Hosting[/direct] [direct=https://cloudhost.in.th/cloudvps.html]Cloud Server[/direct] [direct=https://cloudhost.in.th/vpshosting.html]Cloud VPS Hosting[/direct] [direct=https://cloudhost.in.th/windowsvps.html]Cloud Windows[/direct] Tel: 080-348-0843 LINE: ixvlnw