Support » Plugin: WP LinkedIn » Codes for displaying Projects section

  • Resolved Wan-rong Jih


    Thank you for supporting this plugin.
    Even though the linkedIn API document of Profile Fields does not contain information of Projects fields, I find a way to show the projects data.

    There two parts should be changed:

    • plugin setting: for making this plugin can retrieve project data.
    • php codes: add some codes in order to show the data.

    For the plugin setting of profile fields, add the following:

    projects:(name, start-date, end-date, members:(person:(first-name, last-name), name), description)

    In addition, the following codes should be added to the profile.php

    <?php if (isset($profile->projects->values) && is_array($profile->projects->values)): ?>
    <div id="projects" class="section">
    <div class="heading"><?php _e('Projects', 'wp-linkedin'); ?></div>
    <?php foreach ($profile->projects->values as $v): ?>
    <div class="projects">
    <div class="name"><?php echo $v->name; ?>
    <?php if (isset($v->startDate)): ?>
    (<?php echo $v->startDate->year; ?> - <?php echo isset($v->endDate) ? $v->endDate->year : __('Present', 'wp-linkedin'); ?>)
    <?php endif; ?>
    <?php if (isset($v->members)): ?>
    <p>Team members:
    <?php $members = array();
    foreach ($v->members->values as $m) {
    if (isset($m->name)) {
    $members[] = '<span class="member">'. $m->name . '</span>';
    else {
    $members[] = '<span class="member">'. $m->person->firstName . ' ' . $m->person->lastName . '</span>';
    echo implode(', ', $members);
    <?php endif; ?>
    <?php if (isset($v->description)): ?>
    <div class="summary"><?php echo wpautop($v->description); ?></div>
    <?php endif; ?>
    <?php endforeach; ?>
    <?php endif; ?>

    I’m not familiar with php, please feel free to make it better.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Codes for displaying Projects section’ is closed to new replies.