Need help with Other Posts Plugin
-
I like this particular related-posts plugin better than several similar ones, but I’m having one small issue that I’m hoping someone can help with.
My theme does not use the typical upload-and-insert method of adding images, so they don’t exist as ‘attachments’ – rather they are added as a value in a custom field and then place in the appropriate spot with this PHP code:
$values = get_post_custom_values(“Image”); echo $values[0];
Thus the post images are not showing up where they should be with this plugin.
I’ve tried a couple of modifications to the plugin.php file, but am not having success. This is the section of plugin.php that deals with the post image:
function oposts_extract_image($post_id) {
$attachments = get_children(array(
‘post_parent’ => $post_id,
‘post_status’ => ‘inherit’,
‘post_type’ => ‘attachment’,
‘post_mime_type’ => ‘image’,
‘order’ => ‘ASC’,
‘orderby’ => ‘menu_order ID’
)
);
if (empty($attachments)) {
return get_option(‘siteurl’) . ‘/wp-content/plugins/other-posts/images/empty.gif’;
}
foreach ($attachments as $id=>$attachment ) {
$image = wp_get_attachment_image_src($id, ‘thumbnail’);
$image = $image[0];
break;
}
return $image;Can someone tell me how to modify the plugin.php file to use my custom field instead of looking for an attachment?
Many thanks!
- The topic ‘Need help with Other Posts Plugin’ is closed to new replies.