How to insert thumbnails into external php page
-
Hello,
How can I insert the latest posts (as thumbnails only) without using wp-blog-header.php . Something like pure sql injection.
wp-blog-header.php crashed after the last update, See my post: https://www.ads-software.com/support/topic/wp-blog-headerphp-problem-in-external-htmlHere is a custom code for insert titles only.
<?php //connect to the database mysql_connect($dbhost, $dbuser, $dbpassword); @mysql_select_db($dbName) or die("Unable to select database"); //get data from database -- !IMPORTANT, the "LIMIT 5" means how many posts will appear. Change the 5 to any whole number. $query = "Select * FROM wp_posts WHERE post_type='post' AND post_status='publish' AND ID IN (SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id = 10) ORDER BY post_date DESC LIMIT 5"; //insert post taxonomies $query_result = mysql_query($query); $num_rows = mysql_numrows($query_result); //close database connection mysql_close(); for($i=0; $i< $num_rows; $i++){ $blog_date = mysql_result($query_result, $i, "post_date"); $blog_title = mysql_result($query_result, $i, "post_title"); $blog_content = mysql_result($query_result, $i, "post_content"); $blog_permalink = mysql_result($query_result, $i, "guid"); $blog_date = strtotime($blog_date); $blog_date = strftime("%b %e", $blog_date); ?> <a href="<?php echo $blog_permalink; ?>" target="_blank"><?php echo $blog_date; ?>: <?php echo $blog_title; ?></a> <?php } ?>
- The topic ‘How to insert thumbnails into external php page’ is closed to new replies.