Featured Image Par Wrong Alt And Title Attribute Show Ho Raha Hai


(Mohd Kashif) #1

meri site ke featured image me title aur alt attribute ki jagah post ka title aur alt attribute display ho raha hai me ye code

add_filter('the_content', function($content) { $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); $img = '<img src="'.$url.'" alt="'.get_the_title().'" title="'.get_the_title().'"/>'; $content = preg_replace('#(<p>.*?</p>)#','$1'.$img, $content, 1); return $content; });

use kar raha hun, image ka title aur alt kaise display kare jo mene image upload karte time diya tha


(Jumedeen khan) #2

Dear featured image me post ka Alt And Title Attribute hi show hota hai. Agar aap single page ki bat kar rahe ho to aapko single page par featured image dikhane ki jarurat nahi hai. featured image aapki post ki kisi image ko chuna jata hai, wo post me bhi show hoti hai.

For more: site ka link btao main review karke dekhta hu.


(Mohd Kashif) #3

link https://zaykarecipes.com/


(Jumedeen khan) #4

Aapki blog par post aur pagination yani post image aur featured image dono jagah par post title show ho raha hai. iski wajah hai aapke btaye gaye code me add ye title and alt code.

alt="'.get_the_title().'" title="'.get_the_title().'"

Aap is pure hi code ko fonctions.php se remove kar dijiye aur featured image post editer ke right side sidebar ke bottom se select kijiye problem solve ho jayegi na ho to yaha puch sakte ho.


(Mohd Kashif) #5

aapke dwara bataya hua code remove kar diya hai aur featured image jaha hota hai post editer ke right didbar me wahi se select karta hun lekin ab koi title alt attribute nahi show ho raha hai
mene check kiya aapke blog par to sabhi image ke uper hover karne se title aata hai aur source code me alt attribute bhi sahi show hota hai


(Jumedeen khan) #6

Aap is tarah se image alt text add kare.