Show images outside WP
-
Hi guys
On a page outside of WP i’m showing some posts and everything works well, except i cannot (my knowledge is not that good) show thumbnail images of those posts
Here’s the code I’m currently using
<html> <head> <link rel="stylesheet" type="text/css" href="style.css"> <title>TITLE</title> <meta charset="UTF-8"> </head> <body> <p><img src = "xxxxx.png" align = "middle"></p><body> <?php $dbhost = 'xxxxxx'; $dbuser = 'xxxxxx'; $dbpass = 'xxxxxx'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } mysql_select_db('ime_baze'); $sql = "SELECT DISTINCT post_id, post_author, post_date_gmt, guid, post_title, post_content, meta_value, meta_id FROM <code>wp_posts</code> inner join <code>wp_postmeta</code> ON wp_posts.ID = wp_postmeta.post_id WHERE post_status = 'publish' AND (meta_key = 'st_date') " ; $sql2 = "SELECT DISTINCT post_id, post_author, post_date_gmt, guid, post_title, post_content, meta_value, meta_id FROM <code>wp_posts</code> inner join <code>wp_postmeta</code> ON wp_posts.ID = wp_postmeta.post_id WHERE post_status = 'publish' AND (meta_key = 'end_date') " ; $sql3 = "SELECT DISTINCT post_id, post_author, post_date_gmt, guid, post_title, post_content, meta_value, meta_id FROM <code>wp_posts</code> inner join <code>wp_postmeta</code> ON wp_posts.ID = wp_postmeta.post_id WHERE post_status = 'publish' AND (meta_key = 'prizorisce') "; $sql4 = "SELECT DISTINCT post_id, post_author, post_date_gmt, guid, post_title, post_content, meta_value, meta_id FROM <code>wp_posts</code> inner join <code>wp_postmeta</code> ON wp_posts.ID = wp_postmeta.post_id WHERE post_status = 'publish' AND (meta_key = '_wp_attached_file') Order by 'post.id'"; ; $retval = mysql_query($sql, $conn); $retval2 = mysql_query($sql2, $conn); $retval3 = mysql_query($sql3, $conn); date_default_timezone_set('Slovenia/Celje');?> <h1 class="dan">Danes dogaja: </h1> <?php if(! $retval) { die('Could not get data: ' . mysql_error()); } $danes = date('d-m-Y'); while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { $id=$row['post_id']; $row2 = mysql_fetch_array($retval2, MYSQL_ASSOC); $row3 = mysql_fetch_array($retval3, MYSQL_ASSOC); $zacetek = date("d.m.Y", strtotime($row['meta_value'])); $konec = date("d.m.Y", strtotime($row2['meta_value'])); $dc = date("d.m.Y", strtotime($danes)); $slika = $row4['meta_value']; if(($zacetek <= $dc && $konec >= $dc)) if($row['post_id']==$row2['post_id']) { echo "<a href=".$row['guid']. "> <hr/><h1 class ='naslov'>{$row['post_title']}</h1></a> <br> "; if(($row['post_id'] == $row2['post_id']) && $row2['post_id'] == $row3['post_id']){echo "<span class='lokacija'>{$row3['meta_value']}</span><br>";} echo "Za?etek: <span class='zacetek'>$zacetek</span> ". "<span class='konec'><span class='crna'>Konec:</span> $konec</span> <br> ". "<p class='vsebina'> {$row['post_content']} <br> </p>". /*"<img src='getimage.php?id=$id></img>".*/ "<a href=".$row['guid']. ">Ve? informacij</a>"; } } mysql_close($conn); ?> </body> </html>
Thank you for any help or suggestion
- The topic ‘Show images outside WP’ is closed to new replies.