Support

Home Forums Event Espresso Premium EE – People Add On Display Description of Type

EE – People Add On Display Description of Type

Posted: March 11, 2017 at 10:53 am

Viewing 7 reply threads


gpahu

March 11, 2017 at 10:53 am

Afternoon all,
I would like to be able when i go to site/people-type/type-name(where type-name is my people type) be able to display the type name and the type description and then display all the people assigned to that people-type.
Ive gotten the people in that group to be displayed but I cant seem to find where the people type name and description are stored.
Any help would be appreciated.


Seth Shoultes

  • Support Staff

March 13, 2017 at 3:11 pm

Hi there,

I think you should be able to use the EE_Person object. You can see where it’s used in the template files, here:

  • /eea-people-addon/public/templates/content-espresso_events-people.php
  • /eea-people-addon/public/templates/content-espresso_people-details.php


gpahu

March 14, 2017 at 10:32 am

Hi Seth,
I had the same idea. I used Tony’s advice from another ticket by using Kint Debugger with d ($people_obj) where $people_obj is set as $people_obj = $post->EE_Person; and I set this in my child theme in the file content-espresso_details.php. When I look at Kint debugger and the methods therein there is no mention of description or people-type-category

What am I missing?
Thanks in advance, Steph


Tony

  • Support Staff

March 14, 2017 at 1:44 pm

So to be clear, have you created a custom template to display the people details or are you just using the standard urls to list the people from a type?

/people-type/ is the re-write rule for the espresso_people_type taxonomy.

/type-name/ will be the term within that taxonomy.

So when you navigate to /people-type/type-name/ your viewing all posts that have been assigned the ‘type-name’ term from the espresso_people_type custom taxonomy.

https://code.tutsplus.com/tutorials/understanding-and-working-with-taxonomies-and-terms-in-wordpress–cms-21051

Unless you want to display the term description for each individual person within the list, you can’t use the EE_Person object as that’s for the posts within the loop, not the current output.

Is this what you are trying to do? – http://take.ms/d5q1e


gpahu

March 15, 2017 at 2:36 pm

thanks tony. Yes im using the people-type as the navigator. so when i navigate to /people-type/type-name i want to view all the people assigned to that type. However I want to display the type-name and the type-description at the top of the page. It is asking to the image I showed you.
I did create a custom template in my child theme archive-espresso_people.php and in there get_template_part( ‘content’, get_post_type() ); i then created a content-espresso_people.php with this code therein
<?php
$people_obj = $post->EE_Person;
d($people_obj);
?>
<div class=”staff-info”>
<div class=”staff-image”>
<?php if ( has_post_thumbnail() ) : ?>
” title=”<?php the_title_attribute(); ?>”>
“/>

<caption><?php the_content(); ?></caption>
<?php endif; ?>
</div>
<div class=”staff-details”>

  • Email: <?php echo $people_obj->email(); ?>
  • Phone: <?php echo $people_obj->phone(); ?>
  • Address: <?php foreach ($people_obj->full_address_as_array() as $value) {echo $value . ” ” ;}?>
  • Company: <?php echo get_post_meta( get_the_ID(), ‘company’, true ); ?>
  • <?php echo has_excerpt() ? get_the_excerpt() : ‘ ‘; ?>

</div>
<p class=”clear”></p>
</div>

So to summarize, i’d like to display the type-name and the type-name description when someone navigates to mysite.com/people-type/type-name

Thanks in advance for any help
Steph


Tony

  • Support Staff

March 15, 2017 at 4:16 pm

content-espresso_people.php is used for the loop right? Meaning its too late to use that to display the description just one within that.

So as you know, the taxonomy is using the archive template, so its basically an archive, archive-espresso_people.php is where you want to add the additional details, at the top of the page.

If we take a look at how twentyfifteen does this (which is what I used for my screenshot) you’ll find the archive.php template has this:

<header class="page-header">
	<?php
		the_archive_title( '<h1 class="page-title">', '</h1>' );
		the_archive_description( '<div class="taxonomy-description">', '</div>' );
	?>
</header><!-- .page-header -->

Which is what is outputting the taxonomy title and description.

Add the above two functions to your archive-espresso_people.php and it will output the type name you have set (the title) and the type description.

Here is an how it looks from the 2017 archive example I used – http://take.ms/ECpDi


gpahu

March 15, 2017 at 7:10 pm

Thanks a million Tony – that’s the trick.
For others who may want to do achieve the same goal:
I placed it in my child theme’s archive-espresso_people.php file before the loop
<header class=”page-header”>
<?php
the_archive_title( ‘<h1 class=”page-title”>’, ‘</h1>’ );
the_archive_description( ‘<div class=”taxonomy-description”>’, ‘</div>’ );
?>

</header>


Tony

  • Support Staff

March 16, 2017 at 4:56 am

Thanks for sharing Steph, I’m glad you got it working 🙂

Viewing 7 reply threads

The support post ‘EE – People Add On Display Description of Type’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso