I have two WP sites. I want to reach from one of them, into the other, and retrieve specific featured images for posts, and display them with a link to that post.
I am using this line (with the correct info for my target database):
$mydb = new wpdb('username','password','database','localhost');
What would I follow that with to retrieve and display a post thumbnail?
I am tinkering with a line of code I found elsewhere that looks like this:
$result = $mydb->get_results("select * from wp_posts where ID='1885'");
where ‘1885’ is a sample post ID number.
In an ideal world, I would develop this to the point where it functions as a widget. The client could simply enter a post ID number from the external WP site, and the widget would retrieve the appropriate thumbnail, and display it as a link back to the appropriate post on the other site.
I am not literate at all with PHP. So far I do my best just manipulating snippets and working them into my theme templates.