Support

Home Forums Event Espresso Premium People Add on DIVI theme People Type – Directors

People Add on DIVI theme People Type – Directors

Posted: December 28, 2023 at 3:52 pm

Viewing 7 reply threads


gpahu

December 28, 2023 at 3:52 pm

Evening all,
So I have been using the People Add on for years and had created a People Type and displayed and sorted the code like a previous support post here – https://eventespresso.com/topic/ee-people-add-on-display-description-of-type/

However, I have moved from Iced Mocha to a DIVI theme site and when I use the code in the pages archive-espresso_people.php and archive-espresso-people_type-board-of-directors.php , I think its the wrong CUSTOM pages for the most recent version of Event Espresso.

So where should I put the modified details for sorting and displaying people-type category ?

Thanks
Steph


Rio

  • Support Staff

December 28, 2023 at 11:35 pm

Can you confirm if this is working perfectly on different theme? or was it working with earlier EE version? what was the last EE version you remember that this thing work?

thanks


Rio

  • Support Staff

December 28, 2023 at 11:35 pm

Can you confirm if this is working perfectly on different theme? or was it working with earlier EE version? what was the last EE version you remember that this thing work?

thanks


gpahu

December 29, 2023 at 3:38 am

Hi. Yes this worked on the Iced Mocha theme with latest version of EE.
We are updating our site to DIVI Theme and I wanted to able to recreate the display for People Type Category


See archive-espresso-people_type-board-of-directors
get_header(); 
$post_type = 'espresso_people';
$taxonomy = 'espresso_people_type';
$terms = get_terms( array(
	'taxonomy'=>$taxonomy,
	'orderby'=>'name',
	'order'=>'DESC',
));

?>
<div id="main-content">
	<div class="container">
		<div id="content-area" class="clearfix">
			<div id="left-area">
			<?php espresso_theme_before_content_hook(); ?>
			
			<?php if ( have_posts() ) : ?>

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

	<?php

	$exec_term = 'Executive'; // '451';
	$exec_ids = array();
	// firsat select the execituves
	$execs = get_posts(array(
			'post_type'=>$post_type,
			'posts_per_page' => '-1',
			'suppress_filters'=>false,
			'tax_query'=>array(
				array(
					'taxonomy'=>$taxonomy,
					'field'=>'slug',
					'terms'=>$exec_term
					)
				),
			'meta_key' => 'officer_print_order',
			'orderby' => 'meta_value',
			'order' => 'ASC'
			)
		);

    foreach( $execs as $post ) :
		$exec_ids[] = $post->ID;
    	?>
		<li>
			<?php 
			get_template_part( 'content', get_post_type() ); ?>
		</li>
		<?php 
    endforeach;
// d($exec_ids);
	// now get the board member
	$term = 'Board of Directors'; // '437';
	$posts = get_posts(array(
		'post_type'=>$post_type,
		'posts_per_page' => '-1',
		'suppress_filters'=>false,
		'tax_query'=>array(
			array(
				'taxonomy'=>$taxonomy,
				'field'=>'slug',
				'terms'=>$term
				)
			),
		'orderby' => 'EE_Person.PER_lname',
		'order' => 'ASC',
		'exclude' => $exec_ids,
		)
	);
function cmp_lastname($a, $b)
{
	return strcmp($a->EE_Person->lname(),$b->EE_Person->lname());		
}

	usort($posts, "cmp_lastname" );
	
// d($posts[0]);
		foreach( $posts as $post ) :
	
    	?>
		<li>
			<?php 
			get_template_part( 'content', get_post_type() ); ?>
		</li>
		<?php 
		endforeach;
// Now get Executive Director
	$exec_term_d = 'Executive Director'; // '441';
		// firsat select the director
	$execs_d = get_posts(array(
			'post_type'=>$post_type,
			'posts_per_page' => '-1',
			'suppress_filters'=>false,
			'tax_query'=>array(
				array(
					'taxonomy'=>$taxonomy,
					'field'=>'slug',
					'terms'=>$exec_term_d
					)
				)
			)
		);

	usort($execs_d, "cmp_lastname" );

    foreach( $execs_d as $post ) :
		 	?>
		<li>
			<?php 
			get_template_part( 'content', get_post_type() ); ?>
		</li>
		<?php 
    endforeach;
	//	if($iced_mocha_pagination=="Enable") iced_mocha_pagination(); else iced_mocha_content_nav( 'nav-below' ); 
    ?> </ul> 
	<?php

//	endforeach;
 				
else : ?>

					<article id="post-<?php the_ID(); ?>" <?php post_class( 'et_pb_post' ); ?>>

				<?php
					$thumb = '';

					$width = (int) apply_filters( 'et_pb_index_blog_image_width', 1080 );

					$height    = (int) apply_filters( 'et_pb_index_blog_image_height', 675 );
					$classtext = 'et_pb_post_main_image';
					$titletext = get_the_title();
					$alttext   = get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true );
					$thumbnail = get_thumbnail( $width, $height, $classtext, $alttext, $titletext, false, 'Blogimage' );
					$thumb     = $thumbnail["thumb"];

					et_divi_post_format_content();

					if ( ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) ) {
						if ( 'video' === $post_format && false !== ( $first_video = et_get_first_video() ) ) :
							printf(
								'<div class="et_main_video_container">
									%1$s
								</div>',
								et_core_esc_previously( $first_video )
							);
						elseif ( ! in_array( $post_format, array( 'gallery' ) ) && 'on' === et_get_option( 'divi_thumbnails_index', 'on' ) && '' !== $thumb ) : ?>
							<a>">
								<?php print_thumbnail( $thumb, $thumbnail["use_timthumb"], $titletext, $width, $height ); ?>
							</a>
					<?php
						elseif ( 'gallery' === $post_format ) :
							et_pb_gallery_images();
						endif;
					} ?>

				<?php if ( ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) ) : ?>
					<?php if ( ! in_array( $post_format, array( 'link', 'audio' ) ) ) : ?>
						<h2 class="entry-title"><a>"><?php the_title(); ?></a></h2>
					<?php endif; ?>

					<?php
						et_divi_post_meta();

						if ( 'on' !== et_get_option( 'divi_blog_style', 'false' ) || ( is_search() && ( 'on' === get_post_meta( get_the_ID(), '_et_pb_use_builder', true ) ) ) ) {
							truncate_post( 270 );
						} else {
							the_content();
						}
					?>
				<?php endif; ?>
					</article> <!-- .et_pb_post -->
			<?php
					endwhile;

					if ( function_exists( 'wp_pagenavi' ) )
						wp_pagenavi();
					else
						get_template_part( 'includes/navigation', 'index' );
				else :
					get_template_part( 'includes/no-results', 'index' );
				endif;
			?>
			</div> <!-- #left-area -->

			<?php get_sidebar(); ?>
		</div> <!-- #content-area -->
	</div> <!-- .container -->
</div> <!-- #main-content -->


Tony

  • Support Staff

January 4, 2024 at 6:33 pm

Hi there,

So the code above is from an archive-espresso-people_type-board-of-directors.php file? What was/is calling that file within Mocha? (That filename isn’t in a format I recognise, so something is calling it?)

The way these templates load hasn’t changed in a very long time now, it mainly using the WP template hierarchy and then injects custom template files into the relevant templates after that. The filename above doesn’t fit the hierarchy so I assume there is something within archive-espresso_people.php calling those additional templates?


gpahu

January 5, 2024 at 2:22 am

I created it based on your excellent advice – See https://eventespresso.com/topic/people-add-on-display-multiple-people-type-on-a-single-page/ and https://eventespresso.com/topic/ee-people-add-on-display-description-of-type/
We are updating our site to a Divi Theme and our content too. I’d like to do the same thing show People Type Board of Directors and Sort by Last Name.

Any help would be greatly appreciated.

Thanks
Steph


Tony

  • Support Staff

January 5, 2024 at 5:00 am

Hi Steph,

I created it based on your excellent advice – See https://eventespresso.com/topic/people-add-on-display-multiple-people-type-on-a-single-page/ and https://eventespresso.com/topic/ee-people-add-on-display-description-of-type/

Sure, but… the filename is different in that thread:

taxonomy-espresso-people_type-board-of-directors.php

So

taxonomy-$taxonomy-$term.php

According to the WP Template hierarchy, make sense as your viewing a custom taxonomy archive.

In your example above your filename appears to use:

archive-espresso-people_type-board-of-directors.php

So archive-$taxonomy-$term.php?

Starting with the one that should work regardless:

archive-espresso_people.php

If you add some output to test that output from the template (a h1 with ‘TESTING’ for example), does that output on the People archive?


gpahu

January 19, 2024 at 6:27 am

Apologies for the delay. The code I am referring to is for the Iced Mocha theme and it worked great. We created one archive-espresso_people.php and one archive-espresso_people_type-board-of-directors.php.
However, these files do not work on our new site – which has a default DIVI theme.
Questions – the code works but what area of the loop do I need to put it in ?

Viewing 7 reply threads

The support post ‘People Add on DIVI theme People Type – Directors’ 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