Our online favicon generation tool (until a few days ago) included an API to return a favicon image that could be used with a PHP function to render the icon alongside any outgoing website link. The icon adds a stylistic element to links and provides a means of immediate brand recognition and assurance for popular websites.
While the service was free and provided a funky feature to users, it wasn't without benefit on our end. Every time a request was made for an icon we would record various details as a means of measuring traffic to certain sites, and it gave us a unique means of measuring web trends. However, like all API-based services, it attracted its fair share of spammers and would at times result in dodgy online practitioners batch-requesting multiple hundreds of thousands of icons for their own use. It's this ongoing abuse that has forced us to provide a time-expiry on the existing free icon API (the site will continue to manufacture site icons from uploaded images only). The API will be improved upon and ported over as a registered tool to this website in the next month. If you're existing legitimate user, get in touch and we'll provide you with a key.
Link-optimization is a hugely neglected part of SEO, and one of those areas that authors don't necessarily consider when producing content. Our client-only (at this stage) plugin turns links into magnets, and it feeds search engines with everything they need to rank your content with authority.
For those that couldn't be bothered with our new-and-improved service in the future, you can use a Google alternative to render a site icon alongside outgoing links. The function below makes use of Google's icon API to return links that aren't visibly different from our own current link functions.
Like all unregistered and 'unofficial' APIs provided by Google, there's no guarantee of continued availability. However, the advantage of shortcode is that if (and when) Google closes its doors you can simply migrate over to another service.
Before we port the API over to this site, we'll make details available here.
The Result
The shortcode of [link url="http://www.flight.org/" title="FLIGHT Link"]link in here[/link]
returns the following: link in here (a link rendered with an icon image). For an external link where you haven't defined a title, we'll return 'External Link'. The icon itself will have a title element matching the destination site's root domain.
If you're linking internally, a post ID is always preferred to a qualified URL (the ID won't be affected by permalink changes, domain changes, site reconfiguration etc). In such cases where you sensibly choose to use an ID rather than a URL, the shortcode of [link url="5156"]link in here[/link]
will return link in here . Note that we've automatically retrieved and applied the title text. However, if you define your own title in your shortcode, we'll use your custom text.
If you link to an unpublished post, we'll return an empty link with the title of 'Not Yet Published'. If the ID referenced in your shortcode is an image, we'll return an image link with title and alt tags automatically populated (as long as you include the title tags when uploading images).
For those using our existing link shortcode function, the code below is a cut-and-paste replacement.
WordPress Shortcode
Copy and paste the WordPress function into your theme's functions.php
file or, if you sensibly have one installed, your custom functions plugin.
The shortcode requires that you include the function from "Get Root Domain from a URL with PHP" from this page.
If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.
Shortcode Attributes
The following attributes are available.
url
title
size
target
follow
rel="nofollow"
tags to all outgoing links . To disable the tag, use follow="1"
.internal
align
PHP Function
The purpose of the PHP function is to return just the Google icon.
Considerations
- Our forthcoming code (dealing with our own API) includes additional link features such as automatically populating (and checking) and destination titles and automatic link truncation. It's more of a complete link-SEO solution than just a simple tool.
The Favicon Series
- The Importance of a Website Favicon — July 23, 2017
- Reference (Additional) Device Favicons in WordPress — July 26, 2017
- Favicons with Outgoing Links in WordPress (or PHP) With Google’s Icon API — July 27, 2017
- One-Click Website Favicons and Automated Maintenance — April 13, 2021
Download
Title: Favicons with Outgoing Links in WP (or PHP) With Google's Icon API)
Description: Favicons with Outgoing Links in WordPress (or PHP) With Google's Icon API.
Download • Version 0.1, 1.0K, zip, Category: WordPress Shortcodes