A manual tweak for icons in the Syndication Links plugin

I’m not sure why I had never manually done the fix before, but I’ve had issues1 2 with the Syndication Links plugin showing icons for the reading.am service and my old chrisaldrich.wordpress.com site, which I primarily use as a pseudo-mirror/backup to my primary site. I figured there had to be a way to force them in instead of relying on the set up to process the links and show something. Reading.am doesn’t work because there isn’t an svg available for it and though there’s a WordPress icon, the plugin’s parser doesn’t seem to be able to recognize the subdomain properly.

Within the code at class-syn-link-domain-icon-map.php, I added the following two lines to the obvious spot in the list within the code to fix the icon issues I was having:

'chrisaldrich.wordpress.com' => 'wordpress',
'reading.am' => 'book',

I then reuploaded the edited file to my server. Essentially I’m hard-coding the domain name and the default icon I’d like to have the plugin display.

If the plugin is updated, I’ll obviously have to manually add them again, but the disappearance of the icons again will be pretty obvious and this post will document the necessary changes.

Although upon tweaking this I’m noticing that the reading.am icon isn’t working (I also tried ‘website’ instead of ‘book’ but that didn’t work either). Perhaps the .am tld is causing an issue? Alas…

I suspect that there’s some other bug hiding in the works as one or both of the two types of links above should default to the generic ‘website’ icon when a syndication link exists, but the system isn’t able to specify a particular icon. There may be some small if/else bug hiding in the logic of the plugin.

Published by

Chris Aldrich

I'm a biomedical and electrical engineer with interests in information theory, complexity, evolution, genetics, signal processing, IndieWeb, theoretical mathematics, and big history. I'm also a talent manager-producer-publisher in the entertainment industry with expertise in representation, distribution, finance, production, content delivery, and new media.

8 thoughts on “A manual tweak for icons in the Syndication Links plugin”

  1. So I went back in today and explicitly added ‘www’ to make it 'www.reading.am' => 'book', and that seemed to fix the icon problem. Now to find the piece of code that specifies the hover text for the icon and fix that too.

  2. I’d need to spend some time looking into this to confirm either way, but my gut tells me you should be able to use the syn_link_mapping filter and a function to make these tweaks via your theme’s functions.php file, without hacking the plugin code itself.I want to do something similar for my Mastodon profile link, so I’ll try to take a look into it in the next couple of days 😃

  3. My gut was right 😃. You can add extra icons without editing the plugin, by adding something similar to this to your theme’s functions.php

    function wp4632_extra_site_icons( $return, $url) {
    $sites = array(
    ‘chrisaldrich.wordpress.com’ => ‘wordpress’,
    ‘www.reading.am’ => ‘book’,
    );
    $parsed = parse_url( $url );
    $return = false;
    if ( false !== $parsed ) {
    $host = $parsed[‘host’];
    if ( array_key_exists( $host, $sites ) ) {
    $return = $sites[ $host ];
    }
    }
    return $return;
    }
    add_filter( ‘syn_link_mapping’, ‘wp4632_extra_site_icons’, 10, 2);

    For maximum upgrade safety, I put modifications like this into a child theme.Without similar code in my theme, this post doesn’t display the (test) Mastodon syndication link… but with it the link and icon are displayed. The $sites array can be modified with any URLs you want mapped to a suitable icon in the set.Hope this helps you out!

  4. Some further notes:
    I also noticed that I didn’t have a Hypothes.is svg icon for syndicating there. So I swiped the habr icon from the plugin’s svg folder and copied it as a new file with the name hypothesis and changed the title attribute from within the file. I then added a hypothesis line to includes/simple-icons.php and the appropriate line (as above) in includes/class-syn-link-domain-icon-map.php. This seems to work a charm, though I may go back and use Chris’ alternate example so I don’t need to rec0de for every plugin update.

    These should work temporarily until I can get the appropriate .svg files and create a PR for the plugin directly.

  5. Love this. My question, though. How does one get reading.am to work? I have tried to find a way to have all of my reads go to my site as such, but even with the Chrome extension, haven’t figured it out yet. I won’t proceed with this until the bugs are fixed.

    1. Katherine, typically I use a third party service along the lines of Zapier, IFTTT, or Automate.io, to pull in RSS feeds from services like Reading.am into my site in a simple/automated way. There are also various Hooks one can also use within their service if you want to customize things.

Leave a Reply

Your email address will not be published. Required fields are marked *