Hi May,
The main problem I see with the code you posted is that line:
<?php foreach ($profile->role->values as $v): ?>
I think it should be:
<?php foreach ($profile->volunteer->values as $v): ?>
I also recommend you use var_dump($profile)do see exactly how it looks likes because sometime the name of the fields are not what is advertised in the doc and this one could be volunteerExperience instead of just volunteer
Hi May,
Did you make this work? If yes I would be interest in integrating that part you developed in the standard templates if you agree 🙂
Regards,
C.
Hi Claude,
Unfortunately it didn’t work. I tried changing from “role” to “volunteer”, nothing changed. I used var_dump($profile) and this is what I got..showing you 2 examples (since it’s a long list)
["volunteerExperiences"]=>
object(stdClass)#18 (2) {
["_total"]=>
int(6)
["values"]=>
array(6) {
[0]=>
object(stdClass)#5 (3) {
["id"]=>
int(64)
["organization"]=>
object(stdClass)#356 (1) {
["name"]=>
string(41) "North York Arts (Toronto Arts Foundation)"
}
["role"]=>
string(49) "Assistant Volunteer Coordinator & Info Ambassador"
}
[1]=>
object(stdClass)#357 (3) {
["id"]=>
int(65)
["organization"]=>
object(stdClass)#358 (1) {
["name"]=>
string(41) "Multiple arts organizations and festivals"
}
["role"]=>
string(23) "Assistant Stage Manager"
}
I made some minor changes and nothing changed on my page.
<?php if (isset($profile->volunteerExperiences->values) && is_array($profile->volunteerExperiences->values)): ?>
<div id="volunteer" class="section">
<div class="heading"><?php _e('Volunteer Experience', 'wp-linkedin'); ?></div>
<?php foreach ($profile->volunteer->values as $v): ?>
<div class="volunteer">
<div class="role"><?php echo $v->role; ?> (<?php echo $v->startDate->year; ?> - <?php echo isset($v->endDate) ? $v->endDate->year : __('Present', 'wp-linkedin'); ?>)</div>
<div class="organization"><?php echo $v->organization->name; ?></div>
<?php if (isset($v->cause)): ?>
<div class="cause"><?php echo nl2br($v->cause); ?></div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
It would be great to add volunteer field to the standard template if things work out.
what’s the list of fields you configured in the settings?
positions, skills, educations, languages, volunteer
Hi, it’s much complex than expected…
Here’s the code you need to put in the template:
<?php if (isset($profile->volunteer->volunteerExperiences->values) && is_array($profile->volunteer->volunteerExperiences->values)): ?>
<div id="volunteer-experiences" class="section">
<div class="heading"><?php _e('Volunteer Experiences', 'wp-linkedin'); ?></div>
<?php foreach ($profile->volunteer->volunteerExperiences->values as $v): ?>
<div class="volunteer">
<div class="role"><?php echo $v->role; ?> (<?php echo $v->startDate->year; ?> - <?php echo isset($v->endDate) ? $v->endDate->year : __('Present', 'wp-linkedin'); ?>)</div>
<div class="organization"><?php echo $v->organization->name; ?></div>
<?php if (isset($v->cause)): ?>
<div class="cause"><?php echo $v->cause->name; ?></div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
and here’s what you need to add to the list of fields:
volunteer:(volunteer-experiences:(organization,cause,role,start-date,end-date))
HTH
Hi, it works now but it doesn’t have formatting. It looks like this:-
Assistant Volunteer Coordinator & Info Ambassador (2013 – Present)
North York Arts (Toronto Arts Foundation)
artsAndCulture
Assistant Stage Manager (2010 – 2013)
Multiple arts organizations and festivals
artsAndCulture
Installation Assistant (2011 – 2013)
Multiple exhibits
artsAndCulture
Front of House Volunteer (2011 – 2011)
The Canadian Stage Company
artsAndCulture
Peer Mentor – Faculty of Fine Arts & York International (2010 – 2012)
York University
education
Student Ambassador (2010 – 2010)
York University
education
Also, would it be possible to include the summary of each role? Thank you.
For the formatting you must tweak your theme’s CSS, for the summary you must add the description field in the list and output it in the template.
Or you just wait for version 1.6 of the plugin since I’ll be adding that to the template and CSS (not to the field list tho)
Okay, that’s good. I added description and formatting by myself for now. Thank you for your help.