pamela_alina — 2013-06-07T15:42:46-04:00 — #1
I would like to know if it is possible to use php code to generate an image ALT. In every page will be the same picture, but ALT will be different (that is the name of the page).
<img src="path-to-my-static-image" width="379" height="70" alt="<?php [B]some-code-here-to-import-wordpress-post-name[/B] ?>" />
Is possible to generate automatic ALT (post name) for the same image ? For wordpress ?
If you have a single image that carries several ALT, how search engines will index the file?
Once? Several times (the number of ALT)?
felgall — 2013-06-07T16:48:17-04:00 — #2
The alt text is what gets used for those people who can't see the image. Unless the image is being used for a different purpose in each page it ought to have the same alt text as that is what people who can't see the image will see or hear instead.
The only time that an image should have different alt text on different pages is where the purpose of the image is different. For example if you have a photo of you and your dog and one page is about you then the alt text might say 'me with my dog' while the same picture on the page about your dog might simply say 'my dog Fido'.
Whatever alt text you use should convey the same meaning as the image would.
I cannot conceive of a situation where the same image would identify which page you are on for more than one page. If the image is supposed to identify the page then a different image would be needed for each page.
pamela_alina — 2013-06-13T10:48:55-04:00 — #3
The only time that an image should have different alt text on different pages is where the purpose of the image is different
My intention was an improvement of SEO.
And economy of resources and labor.
I put the picture once and ALT change from one page to another.
There may be a code like the one that I mentioned above?
john_betong — 2013-06-13T20:20:29-04:00 — #4
<img src="path-to-my-static-image" width="379" height="70" alt="<?php echo $_SERVER['SERVER_NAME'];?>" />
And replace SERVER_NAME with a parameter from the following list:
<?php print r( $_SERVER ); ?>
felgall — 2013-06-13T23:20:23-04:00 — #5
The alternative text has nothing to do with SEO. The intention of that attribute is to tell those people who can't see the image why the image is included in the page. The text MUST relate to that reason or it will be meaningless and blind people and those with images turned off will be uable to use your page properly.
Try reworking the text that everyone can see if you need to update the page for SEO purposes.
picnictutorials — 2013-06-14T00:36:07-04:00 — #6
The alt has a dual function. As said, it tells the blind what the image is, and it tells google (aka seo) what the image is. Word
kalpitz — 2013-06-14T07:07:05-04:00 — #7
<?php echo get_query_var('name'); ?>
this may work if you are using wordpress with seo friendly url
pamela_alina — 2013-06-14T07:51:45-04:00 — #8
Oh, God. PicnicTutorials and kalpitz
You are brilliant. Absolutely brilliant.
You helped me a lot and I implemented in 2 minutes on my site code.
The code for wordpress is :
<a href="<?php bloginfo('url'); ?>">
alt="<?php echo the_title(); ?>"
title="<?php echo the_title(); ?>"
Work like a charm. THANK YOU BOTH !!!
brewtal — 2013-12-06T06:38:51-05:00 — #9
We romanian people think the same I was wondering how to do this and was looking for this stuff for wordpress! Saw it on a website and loved the effects on the SEO, great job Alina
felgall — 2013-12-06T15:48:16-05:00 — #10
Yes but the Google search engine bot effectively is a blind person as it can't see the image. Of course for every bot that can't see the image there are THOUSANDS of living people who can't and the bots are trying to treat the page the same as those people do so targetting the real people is the best thing you can do for SEO.