Pulling the medium image into search.php no longer works with WP 2.8
-
Hi,
I am using the function/code below to pull the medium image from post attachments instead of the fulle size one – on search.php and archive.php. That makes them way faster to load.
It worked well up untill i installed WP 2.8.1. Now no image shows up on search/archive pages – unless i manually insert the medium image into posts along with the full-size one. If I delete the medium image from the post again – it still works! It’s like the medium image wasn’t linked correctly when just inserting the full-size image.
Any idea how to fix this or another way to pull the medium image in 2.8.1?
(code below)
NEW FUNCTION FOR FUNCTIONS.PHP
function wp_get_attachment_medium_url($id){ $medium_array = image_downsize( $id, 'medium' ); $medium_path = $medium_array[0]; return $medium_path; }
SEARCH.PHP – REPLACES THE_CONTENT()
<?php $files = get_children("post_parent=$id&post_type=attachment&post_mime_type=image"); if($files){ $keys = array_keys($files); $num=$keys[0]; $thumb=wp_get_attachment_medium_url($num); print "<img src=$thumb>"; } ?>
- The topic ‘Pulling the medium image into search.php no longer works with WP 2.8’ is closed to new replies.