for people using advanced custom fields for post images
-
for some reason the developer of a site i am fixing used advanced custom fields for post images (instead of featured image field).
this means that the blank image field will cause an error in structured data tester, especially for category archive pages.
in the misc_functions.php file around line 190 I added the follow code// Try something else...for premier stoneworks //small edit by johnny niumata for when someone uses advanced custom fields for post image if ( ! isset($image_url) || $image_url == '' ) { $imageholder = get_field('news_image', get_the_ID()); $image_arr = wp_get_attachment_image_src( $imageholder, 'full' ); $image_url = $image_arr[0]; $image_width = ($image_arr[1] > 696) ? $image_arr[1] : 696; $image_height = ($image_arr[1] > 696) ? $image_arr[2] : round((696/$image_arr[1]) * $image_arr[2]); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘for people using advanced custom fields for post images’ is closed to new replies.