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:
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 and copy the “recommendations.php” and “profile.php” templates from the plugin folder. Then you will need to change those templates to print the headline. For example in “profile.php” add the following line at line 90 of the file:
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