Since I released the WP-LinkedIn plugin for WordPress I got this same request coming regularly about how to add this or that profile information to the output of the plugin. Here is an example that will show you how to add the headline for the recommender.
So let’s say you want that, in the list of recommendations, the current position of the recommender shows up beside their name.
First thing to do when you want to show more profile information is to verify that the information is actually provided by the LinkedIn API. Let’s head up to the LinkedIn API documentation and check if the latest position of the recommender is available.
It’s not really indicated but the “recommender” field in the recommendations is an instance of a “Basic Profile” object for that person (or at least it has a number of the same fields that make a basic profile). If you look at the basic profile fields you will see that there is a collection of “positions” and that positions objects have a “is-current” flag that will tell you wether it’s current or not.
In theory we could use that to determine the curent positions of the recommender but there could be more than one, which would be a problem in our case. Instead, you will notice that the basic profile object also has a “headline” field which is the field people use to actually describe their current roles and positions. We are going to use that field instead of computing the current position.
Once we know what field to use we need to tell the plugin that field needs to be fetched. Go to the LinkedIn options page in the WordPress admin panel and add the “headline” field to the list of fields. If you had the defaults in the LinkedIn option page it should now look like that:
1 |
summary, specialties, languages, skills, educations, positions, recommendations-received:(recommendation-text,recommender:(first-name,last-name,public-profile-url,headline)) |
Now we need to display that information. To do that you need to create custom LinkedIn templates: create a linkedin
folder in your theme your wp-content
folder and copy the recommendations.php
and profile.php
templates from the plugin folder (copying the customized templates in the theme folder still works but, as of version 1.19, this is the preferred method). Then you will need to change those templates to print the headline. For example in “profile.php” add the following code at line 90 of the file:
90 91 92 |
if (isset($v->recommender->headline)) { echo ' - ' . $v->recommender->headline; } |
Et voilà ! If you have any question or remark, feel free to post a comment :)
Image Credits: Jerry Luk
This is great info! I added the info to line 90 of profile.php. I am not sure what modifications to make to recommendations.php. Could you advise?
Hello Andrea,
To do the same thing in
recommendations.php
make sure that lines 10 through 13 look like that:Hi thanks for this – I have made all of the above changes but in recommendations.php nothing is being pulled back for:
recommender->headline; ?>
i.e. it is not being defined or recognised? Any ideas – I have added ‘headline’ as a field under the linked in option page
thanks
Hi, actually there’s a small issue here.
You can customize the template but not the list of fields for the recommendation slider. It should come with the next release.
Hi. I love the idea of your plugin, but I cannot get it to retrieve the profile. It keeps saying “profile could not be received”. And for the recommendations it says I have none when I do actually have some on my linkedin profile. I have regenerated the api and cleared caches
Hi,
Please post more details, like the version of the plugin, any error message you have and the url to the website where you are using it, on the plugin’s support forum, here: http://wordpress.org/support/plugin/wp-linkedin
Thanks
Pingback: How to Showcase your LinkedIn Profile and Recommendations on Wordpress | Adrian Chu
Hi Claude, and thanks for this great plug-in. I am having issues using
picture-url
LinkedIn field.I have added the
picture-url
field to the list of fields in the LinkedIn options page in the WordPress admin panel.I have created a
linkedin
folder in my active template folder.I have added this line in my profile.php and added the file in the linkedin folder within my active template folder:
if (isset($v->recommender->picture-url)) echo $v->recommender->picture-url;
Error message says:
Parse error: syntax error, unexpected '-', expecting ',' or ')'
Perhaps due to the characters used in the linkedin field “picture-url” it is not possible to use it?
picture-url
is not a valid PHP identifier, it’s more likely that the name of the attribute would bepictureUrl
if it was actually returned. The LinkedIn API seems to accept that you ask for the recommender’s picture but is not returning it.Thanks a lot, I still have to figure out how I want it to be displayed, but it works using the attribute you suggested: http://www.pierozilio.eu/#recommendations
Cheers!
Great, you’re right it’s working, I was not testing with the right template :D
Hello Claude,
I am building a personal website with the Pytheas theme.
I ust installed your LinkedIn plugin for WordPress’to present my LinkedIn profile on my profile page. After activating your plugin, my slider on the homepage stops working (I deactivated all plugins and it is really the LinkedIn plugin causing this).
This is the theme
http://wpexplorer-demos.com/pytheas/
(I cann’t show you my website, because is still on localhost).
Do you know what might be the problem?
The picture slider you see on the homepage stops working/freezes after installing this plugin. I hope you can help, because I really like the plugin (and changing the theme isn’t an option).
Greetz
Marcel
Hi Marcel,
It appears that there’s often conflict between the slider that is used in the standard templates of the plugin and other sliders (in themes or otherwise). In that case I recommend you customize the templates to use the slider from your theme (in your case flexslider) instead of jQuery TOOLS’ scrollable.
C.
OK thanx for your swift reply.
Uhm… Sounds as a difficult PHP job. I’m known with CSS, but not so much with PHP or other more serious coding.
I think I will swap then to an another LinkedIn plugin (which doesn’t affect my theme slider), sorry.
Gr
Marcel
Not really PHP, it’s just removing the javascript in the templates and replacing it with the javascript for flexslider.
OK, in which templates of the plugin? And how do I do this?
It’s actually explained in the blog post up there.
Create a “linkedin†folder in your theme and copy the “recommendations.php†template from the plugin folder. Then change that template.
I’m really stuck here… I copied the recommendations.php to a linkedin folder and then changed this recommendation.php by replacing the javascript for flexslider javascript. But then still my slider of the homepage is broken…
Try adding the following PHP at the beginning of your template:
Or should it in the functions.php and look like this?
<?php
function jquery_remove_scripts(){
wp_dequeue_script( 'jquery.tools' );
wp_dequeue_script( 'jquery-dimension-etc' );
}
add_action( 'init', 'jquery_remove_scripts', 100 );
<?
Place within the beginning on the recommendations.php of the plugin? Or at the beginning of the template of my theme?
I was talking about the beginning of the recommendations.php template in your theme. But the version where you put it in functions.php is better, just hook up your remove function to the “wp_enqueue_scripts” hook instead of “init”.
yup, I made a typo there, thanks!
I ended up in putted this code in the functions.php of my template:
function jquery_remove_scripts(){
wp_dequeue_script( ‘jquery.tools’ );
wp_dequeue_script( ‘jquery-dimension-etc’ );
}
add_action( ‘wp_enqueue_scripts’, ‘jquery_remove_scripts’, 100 );
And finally all the things are working fine with the slider! Many thanks!
Hi Claude, nice plugin. I’m trying to add just the activity feed (what we have been commenting on in LinkedIn) to a webpage. Any ideas on how to achieve that?
It should be available in the next release (v1.6)
Hi Claude, I have my linkedin profile set up as the admin of my company page.
How can I set up the display to show my company info and not my prsonal profile?
See here: http://www.linkedin.com/company/4ward-land-surveying
On this sidebar: http://4wardlandsurvey.com/dev/about-us/our-team/
Please advise.
Hi James,
Unfortunately there’s currently nothing to help you with that in my plugin.
Might come in the future tho, but i cannot give you a date.
C.
Hi James!
If you are still interested, I just released a premium extension for WP-LinkedIn that provides shortcodes and widgets for companies.
You can download it here: http://vedovini.net/downloads/wp-linkedin-co
Claude,
I love the plugin, great work. Wondering if there is call/switch to make recommendations random, I have http://www.cortezgroupinsurance.com but every page displays the same start point for the list of recommendations. Any ideas? Thanks.
Good idea Mike, I might add that in a next version. In the mean time you can customize the
recommendations.php
template and add the following line near the top of the file:Awesome!!! Definitely works.
Claude, I’m notice that every few weeks or so, I have to go in and change the margin/random display settings for the widget. I’m assuming the widget is on an auto update configuration for security/enhancement reasons… But I have to keep going back in and altering the settings like margin-left -46px any ideas on how to keep my settings in tact?
Hi Mike,
If you make your changes directly inside the plugin files they will get overwritten with each update of the plugin.
To avoid that I recommend you make your changes into your theme CSS, use a plugin like Jetpack to add the custom CSS or copy the customized template into your theme like indicated in that post.
Regards,
C.
Claude,
I seem to be having trouble making the recommendations possible “jetpack” to alter the css into the theme. Do you have any other suggestions?
Like I said previously you have 3 solutions:
HTH
C.
I’m trying to show a feed that looks similar to this: http://www.linkedin.com/influencer/11846967 where all I want to show is the publications that have been made. Do you have any insight as to how to do this? If not, is this something I could hire you to develop?
Hi Stewart,
If this is your own updates that you are trying to display then there is the
[li_updates]
shortcode that you can use. You will need to customize the template but there will be differences. What that page is showing is a list of blog posts published by LinkedIn (they all have a title, an image and an excerpt). Your updates are a disparate collection of shares, status updates and network informations (like the fact you just changed your profile info) so the result cannot look just like that.C.
Hi Claude,
I’m having trouble to display my education.
See: http://marcoheijkoop.nl/cv/
It is nothing displaying everything.
Did i do something wrong?
Best Regards,
Marco
Hi Marco,
I cannot see your profile on LinkedIn, is the education section complete over there?
C.
Pingback: How to customize the recommendations scroller in WP-LinkedIn | vedovini.net
Hi,
Is there a way to configure the Network Updates Widget so it displays text from updates/stream rather than links back to the profile?
Thanks,
Debbie
Hi Debbie,
That’s already what it’s supposed to do but I reckon there’s a bug in the function that extract links from the updates, I will issue a bug fix soon :)
Thanks for the reporting,
C.
Please check that page to see what it’s supposed to show: http://vedovini.net/network-updates/
Hi,
That’s more like what I want to show, but would it be possible to remove the profile name from the beginning of each line?
Thanks,
Debbie
you need to customize the “network-updates.php” template, this post explains how to do that with the “profile.php” template but it is the same mechanism.
Great, sorted.
Is there at ETA for the function bug update as I see your is now working?
the fix is in version 1.11.2 that I released yesterday
Oops, it hadn’t picked up on the update, but just updated and works perfectly!
Thanks :)
Hi Claude, such a great plugin!
Actually I’m not quite sure on how I can change the length of the summary in the card widget; I see there’s the summary_length attribute, but how can I use it? (Sorry for the probably goofy question, but my coding skills are almost inexistent ;) )
Thanks a lot!
Hi,
It depends how you insert the card. If you use the widget then it’s in the widget admin interface, if you use the shortcode you must add the ‘summary_length’ attribute to the shortcode, if you use the automatic insertion then the summary length is fixed at 2000 characters.
Finally, it’s not documented but you can use the template tag:
wp_linkedin_card(array('summary_length' => 2000));
HTH
C.
Hi Claude: I had two questions:
1) The recommendations are being chopped toward the end of each line…How do I ensure each line is not chopped?
2) I am being unable to make headline work? Can you please lay down the process one more time to add headline? Thank you for the great work!
Hello,
You have to specify the exact width in pixel you want for the slider, however in that case it won’t work for responsive design. If you want the slider to be responsive you have two options,
1. you specify the width as “auto”, however it may not work in all configurations or
2. you specify the with as “css” and then you set the width yourself in your css file
if you want to change the javascript component you will need to customise the template for the recommendations scroller. Check that other article, as there’s a small difference with the profile: http://vedovini.net/2014/01/how-to-customize-the-recommendations-scroller-in-wp-linkedin/
Thanks Claude! I set both width and height as ‘auto’ but no luck. Please see my page for a better context…http://www.qualityaretegroup.com/clients/
Also, I just tested the recommendation slider in ihone 5s and the slider does not work, but text. How can I change the slider you are using to meta slider? What code (where) do I need add/remove to make it a responsive slider?
Claude. It looks perfect now. That you very much again. AD.
Hey man, greetings, it’s been a while. Question… I have this simultaneous strike-through and underline being displayed left/right(if I css w direction rl)(trying to trim/ellipsis – bad idea) of the ‘recommender’ in the scrolling area. I’m not sure what this thing is, but I’m betting it’s a call from echo… just haven’t determined where… text-decoration: none does nothing as it does not appear to be text rather solid object like a picture.
the “rtl” CSS changes the side the :before pseudo element will be but it’s coming from this :before CSS directive which contains “text-decoration: underline;” which is not part of the original CSS coming with the plugin, did you change it? However, the dash before the name is part of the original CSS it just happens to be underline and put behind because of CSS modifications on “.linkedin blockquote .recommender” and “.linkedin blockquote .recommender:before”
i managed to determine that since I couldn’t find any .css or .php file that could account for this mistake yet when I used developer tools to source code it the error it showed as a duplicate, I ran back through until I found an area on the site that would self generate. Sadly, WP with Avada has 3-4 methods for accomplishing this change… and my carelessness overlooked one of them, the glaring “theme options/custom css” as opposed to WP/Appearance/Edit CSS, WP/Plugins/Editor, and conventional CPanel File Manager. So needless to say, I got it worked out… Thanks for responding…
I do have one more question however, can I make a character exception script of sorts? e.g., I can tell the code to display max characters for recommendations, but it would be nice if I could exclude comments from displaying which have less than 40 characters. Is this possible? Thanks.
You can always customize the profile template or the recommendation template to do filter out shorter recommendations. Basically the same process than described on this post but with different templates.
Only thing I can see remotely close to that is and it seems that wouldn’t do anything as that php function would be altering a php element where I believe the linkedin slider is actually a .js container… Anyway, I’ve been fishing around to no avail on how to not show recommendations with less than 60 characters. Any help is appreciated. Thanks again.
“$(function(){
$(‘#slider’).slider({
min: 50,
max: 2500
});
}); “
In the
recommendations.php
template (andprofile-recommendations.php
) there’s a loop to print the recommendations, you just need to insert aif
statement to output only longer recommendations. Just make sure you don’t modify the files in the plugin but put your customized templates in thewp-content/linkedin
folder as indicated.Yea, I’ve tried every If statement on ‘$recommendation’…
if (count($recommendation) > 160){
if ($recommendation > 160) {
different arguments to include strlen and several different functions in several different areas… it will not exclude recommendations of certain character minimums, I think I’m going to give up and just copy + paste my recommendations in to word to spell check them and use my themes review “slider” function 8 hours later. Thanks anyway.
well, the text of the recommendation is in $recommendation->recommendationText or something similar, $recommendation is an object
I had a friend who is a programmer put together some nifty stuff… nothing I would have been able to do by myself… seems more complex than simple “if statement”, why does the profile-recommendations.php need to be amended as well? Also wp-content/plugins can be overridden which is why I suspect you state to have a linkedIn folder in ../wp-content
Am I to delete the wp-content/plugins/wp-linkedin afterwards?
both templates display the recommendations, one as part of the profile and the other is the slider. you might want to have different ways to show them.
do not delete the plugin, the wp-content/linkedin folder should contain only the customized templates not the full plugin.
Hi! I use Accespresslite and the recommendations scroller doesn’t work (doesn’t show at all). Does it has something to do with the slider at my homepage (that it can’t show two sliders at the home page)?
may be, difficult to tell without having a look at it
Hello I want my about me page to be similar to your layout how is this possible?
You need two things. First you need to have LinkedIn give you access to your full profile (see http://vdvn.me/p2lg) and then you can use the Advanced Templates extension or develop your own templates.
Hi, i am new to WP … i have 2 saved searches (job searches) in my linkedin account, i just want to display the output of those searches in my wordpress website….is there a option to do that….(sorry if this question is not relevant here)
Hi, I am not sure what you mean with “job searches” but if you have a company page and you posted job offers there you can show them using the Companies extension of the WP-LinkedIn plugin, here: http://vdvn.me/p1nr
HTH