Support » Plugin: Jetpack by WordPress.com » Workaround for linkedin url problems

  • Resolved hommealone

    (@hommealone)


    Hi,

    In the Jetpack Social Media Icons widget, it is currently not possible to link to a company profile page. (I think this issue effects several Jetpack ‘social’ product, not just this widget, correct?). The Jetpack team is aware of this issue but it has been outstanding for quite a while. See:

    https://github.com/Automattic/jetpack/issues/259

    I’m using a rather crude javascript (jQuery) workaround. Can anyone see problems with this workaround, or suggest a better one until a real resolution is made?

    jQuery(document).ready(function ( $ ) {
    	//////////////////////////
    	// workaround for jetpack follow linkedin problem
    	// monitor issue here:
    	// https://github.com/Automattic/jetpack/issues/259
    	if ( $('.widget_wpcom_social_media_icons_widget a.genericon-linkedin') ) {
    		$('.widget_wpcom_social_media_icons_widget a.genericon-linkedin').attr('href','https://www.linkedin.com/company/comany-user-name/');
    	}
    });

    https://wordpress.org/plugins/jetpack/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Jeremy Herve

    (@jeherve)

    Jetpack Mechanic

    That GitHub issue is related to another Jetpack module, Publicize. If you’d like to customize the Social Media Icons widget, you can use the jetpack_social_media_icons_widget_array filter, like so:

    function jetpackme_linkedin_company_icon( $html_array ) {
        return
            $html_array +
            array(
                25 =>    // This key can be modified to change the order the new item will appear in the list
                    '<a title="Automattic" '
                    . 'href="https://www.linkedin.com/company/automattic" '
                    . 'class="genericon genericon-linkedin" target="_blank">'
                    . '<span class="screen-reader-text">Automattic Company Profile</span></a>'
            );
    }
    add_filter( 'jetpack_social_media_icons_widget_array', 'jetpackme_linkedin_company_icon' );

    You’ll want to add that code in your theme’s functions.php file, or in a functionality plugin.

    Thanks for this workaround; just what I was looking for. It works nicely.

    For anyone else trying this, note that you will need to REMOVE the LinkedIn information from the widget settings; this code adds an additional item to whatever you have enabled with the widget settings, and will result in two LinkedIn icons if you put a LinkedIn username into the settings page.

    Jeremy: For me to know when a permanent fix has been put in place, I’ll need to monitor the link above for the github issue 259, correct?

    Thanks again!!

    Plugin Contributor Jeremy Herve

    (@jeherve)

    Jetpack Mechanic

    For me to know when a permanent fix has been put in place, I’ll need to monitor the link above for the github issue 259, correct?

    That’s a permanent fix, that filter will remain available in the next versions of Jetpack, and we most likely won’t add another LinkedIn field inside the widget options. If we do, you can ignore it and keep using that code snippet, it will keep working.

    The GitHub issue you linked to earlier to related to another Jetpack module, so it won’t affect the Social Media Icons Widget when it gets fixed. You can consequently ignore that issue, unless of course you’re interested in being able to automatically publish your new posts to your LinkedIn Company page thanks to the Publicize module 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Workaround for linkedin url problems’ is closed to new replies.