Support

Home Forums Event Espresso Premium EE4 People – Custom page Template

EE4 People – Custom page Template

Posted: February 19, 2017 at 4:59 am

Viewing 11 reply threads


JacquesMivi

February 19, 2017 at 4:59 am

Hello,

I customize the template “content-espresso_people-details.php” ant I have genesis framework.

I don’t want to display defaults title, meta information and the content.
For the moment I hide It in CSS. Do you have a clean solution ?

https://gist.github.com/lorenzocaum/782a834950be643e10f961c520214933

2) I want to change Jahnichen Jacques in Jacques Jahnichen ?
https://www.viviarto.com/formateurs-organisateurs/jahnichen-jacques/

So I c’ant use the default title post. How can I have people->name and people->nickname ?

Thanks a lot,


Josh

  • Support Staff

February 20, 2017 at 12:34 pm

The part in your template where you have:

echo genesis_do_post_title() is probably what’s displaying the title, so I guess you’d remove that from your template? That would also be the case with the content and meta info:
<?php echo get_the_content();?>

You can edit the permalink by clicking on the edit button next to the permalink. You can also change the post title by editing the first field on the people editor page.


JacquesMivi

February 21, 2017 at 3:19 am

If I remove ‘get_the_content()’ and ‘genesis_do_post_title()’ I still have The Title and The Content on this page. I have to use CSS to hide It.

I d’ont want to use the post title, but I want to get “PER_fname” how can I do it ? I also want “People type”, how can I dot that ?

Have a good day,


JacquesMivi

February 21, 2017 at 9:23 am

Here is an example where my CSS doesn’t work
https://www.viviarto.com/formateurs-organisateurs/fabien-strobel/


Josh

  • Support Staff

February 21, 2017 at 11:10 am

It’s not clear from the code that you posted what’s happening then. Can you post the relevant templates into a gist or paste bin?


JacquesMivi

February 21, 2017 at 11:57 am

https://gist.github.com/JacquesJahnichen/c182fb6b7ae58f680db217c9483e1188


Josh

  • Support Staff

February 21, 2017 at 12:41 pm

Hi there,

I think the problem is you’re only looking at the template that adds to the loop. You probably also have a single.php template, and that’s the template you’ll need to customize. What you can do actually is make a copy of the single.php template, then rename it to be single-espresso_people.php.

Then you can make your customizations to that template.


JacquesMivi

February 24, 2017 at 2:13 am

Yes you right ! Thanks a lot 🙂

Last question “How can I get “PER_fname” ? And “People type” taxonomy ?


Tony

  • Support Staff

February 24, 2017 at 8:53 am

The EE_Person object will be included within $post, so you can do:

$person = $post->EE_Person;

Or using the EE Models you can use:

$person = EEH_People_View::get_person();

Which does some additional checking for you.

Now $person can be used to output all of the details for that person, so:

“How can I get “PER_fname”

echo $person->fname();

And “People type” taxonomy ?

$people_types = $person->term_taxonomies();

($people_types will be an array taxonomies)

I’d recommned using Kint Debugger and wrapping $person in d(); to view all of the available methods you can use on that object.


gpahu

February 27, 2017 at 2:23 pm

good afternoon,
im trying to perform something similar.
i am using a child theme of iced mocha master.
i created an archive-espresso_people.php where espresso_people is the post type for the people add-on in my child theme.
Within archive-espresso_people.php i use CODE get_template_part( ‘content’, get_post_type() );
i then created a content-espresso_people.php and run through the standard loop. id like to display all the info about the people but i’m having an issue with the name of the state from the database
$people_obj = $post->EE_Person;
$email = $people_obj->get(‘PER_email’);
$phone = $people_obj->get(‘PER_phone’);
$address = $people_obj->get(‘PER_address’);
$city = $people_obj->get(‘PER_city’);
$state = $people_obj->get(‘???????’);

Is there a way for me to find all the field names for the espresso_people people type ?

Any help would be greatly appreciated

Thanks
Steph


Tony

  • Support Staff

February 27, 2017 at 3:53 pm

You don’t need to use get() on each of those fields, the EE_Person object has methods available for most of them.

Is there a way for me to find all the field names for the espresso_people people type ?

Sure there is, it’s the method I posted right before your reply:

I’d recommend using Kint Debugger and wrapping $person in d(); to view all of the available methods you can use on that object.

$people_obj = $post->EE_Person;

Means on your page $people_obj is an EE_Person object.

Run d($people_obj); with the above plugin active and you’ll see all of the available methods for that object.

Take a look here for more info on our models:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System


gpahu

March 7, 2017 at 2:44 pm

Thanks a million, Tony. This did the trick and allowed me to see all the methods.
In the interest of anyone who is trying to do the same sort of thing, heres my code
$people_obj = $post->EE_Person;
//d($people_obj); this is now commented out. But its where I put the debug line that Tony was talking about aboce
?>
<div class=”staff-info”>
<?php if ( has_post_thumbnail() ) : ?>
” title=”<?php the_title_attribute(); ?>”>
“/>

<?php endif; ?>

  • 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 . ” ” ;}?>
  • <?php echo has_excerpt() ? get_the_excerpt() : ‘No Website’; ?>

</div>
I placed it in the content-espresso_people.php which I created a copy of in my CHILD theme

Viewing 11 reply threads

The support post ‘EE4 People – Custom page Template’ 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