Thanks for reaching out and sharing a screenshot of what you’re encountering.
As you’re using AMP in reader mode with the legacy theme you can use the below function in order to define a Favicon:
/**
* Add Favicon in the AMP legacy theme.
*/
function xyz_amp_setup_favicon() {
?>
<link rel="shortcut icon" href="https://www.your.com/image/path/imagesname.png" />
<?php
}
add_action( 'amp_post_template_head', 'xyz_amp_setup_favicon' );
You can add the above to your themes functions.php or preferably a custom plugin or a child theme to ensure it doesn’t get overwritten on theme updates. Be sure to change the image URL to point to your own preferred image or favicon.
Let me know if you have any questions with the above.
Thread Starter
T4G
(@tips4gamers)
Thank you for that code. I have implemented it and I assume it will take about a week or so for search results to start displaying the logo?
Thanks for the help!
No problem at all. I would imagine it won’t take that long. As soon as your site is recrawled you should see the updated icon. You may need to check from an incognito browser session or a new device as browser can commonly cache favicons.
Thread Starter
T4G
(@tips4gamers)
Thanks for that!
I think the favicon should be added in the documentation here – https://amp-wp.org/documentation/playbooks/classic-templates/ – as I do not see anything regarding adding a favicon.
Best regards.
That’s a good point. I’ll discuss this with the team and see if I we can get this added within the section you referenced. We’ll keep you posted here with any updates.
It seems there may be an unintended omission of the favicon on AMP pages in legacy Reader mode. This is the code that will get the site icon from your non-AMP pages to also show up on your AMP pages:
add_action( 'amp_post_template_head', 'wp_site_icon' ) ;
In WordPress core, the wp_site_icon()
function runs at the wp_head
action.
Thread Starter
T4G
(@tips4gamers)
Hi @westonruter,
Thank you for that! I went ahead and replaced the first function with that action you gave.
Best regards