This code is from my WordPress theme, it does not add the height, width, or alt to the image,
Well the alt is added but has this Alt= img
Could someone please have a look at the code for possible mistakes, or an alternative code assembly
<a href="<?php the_permalink(); ?>">
<img src="<?php echo esc_url($theme_image); ?>" title="<?php esc_attr(the_title()); ?>" alt="<?php esc_html_e('img','theme'); ?>" width="<?php echo intval($theme_fwidth); ?>px;" height="<?php echo intval($theme_fheight);?>px;" />
What values are in the
$theme_fheight variables if you
var_dump() them prior to that line?
I don’t know wordpress, but looking at the description of the
esc_html_e() function, it appears that it’s doing what you asked it to:
"Displays translated text that has been escaped for safe use in HTML output. If there is no translation or the domain isn’t loaded, the escaped original text is shown. "
You pass in “img” as the string to display, so it displays it. What did you want it to display?
Thank you for your reply
This same code is used in a few places on the site, in other placements it works correctly, giving the displayed image Height & Width dimensions, and an Alt = pic name
But for some reason on the Home page this same code is not displaying any values???
OK, so on the other pages where the code does work, can you see any other code that generates that information?
Good to hear from you
Yes I am looking into the code on the workings pages now,
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.