Support

Home Forums Event Espresso Premium EE4, Custom Template Archive Venue, Genesis

EE4, Custom Template Archive Venue, Genesis

Posted: February 5, 2016 at 8:51 am


JacquesMivi

February 5, 2016 at 8:51 am

Hello,

My aim is to create custom template for the archive venues page. I follow
https://eventespresso.com/wiki/build-custom-espresso-event-post-templates-genesis/

In my genesis child theme, I added 3 files
archive-espresso_venues.php
single-espresso_venues.php
content-espresso_venues.php

Now I can change the informations displayed. But my page isn’t complete. I can’t see anymore the Admin bar, or the footer.

Here is the 3 files

archive-espresso_venues.php

<?php
/**
* Template Name: Venue List
*
* This is template will display a list of your event venues 
*
* Event Registration and Management Plugin for WordPress
*
* @ package		Event Espresso
* @ author		Seth Shoultes
* @ copyright	(c) 2008-2014 Event Espresso  All Rights Reserved.
* @ license		https://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
* @ link			http://www.eventespresso.com
* @ version		EE4+
*/
get_header(); 
?>

<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php espresso_get_template_part( 'loop', 'espresso_venues' ); ?>			
</div><!-- #content -->
</section><!-- #primary -->

<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();

single-espresso_venues.php

<?php
remove_action ( 'genesis_loop', 'genesis_do_loop' ); // Remove the standard loop
add_action( 'genesis_loop', 'custom_espresso_venue_single_loop' ); // Add custom loop
// Optional: Remove post info
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );

// Link https://eventespresso.com/topic/custom-template-2/
function custom_espresso_venue_single_loop() {

if ( have_posts() ) : 

// Start the Loop.
while ( have_posts() ) : the_post();
//  Include the post TYPE-specific template for the content.
espresso_get_template_part( 'content', 'espresso_venues' );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
comments_template();
}
endwhile;

else :
// If no content, include the "No posts found" template.
espresso_get_template_part( 'content', 'none' );
endif;

}

genesis();

content-espresso_venues.php

<?php
/**
* This is template will display a single venue
*
* @ package		Event Espresso
* @ author		Seth Shoultes
* @ copyright	(c) 2008-2013 Event Espresso  All Rights Reserved.
* @ license		http://venueespresso.com/support/terms-conditions/   * see Plugin Licensing *
* @ link			http://www.eventespresso.com
* @ version		4+
*/

global $post;
$wrap_class = has_excerpt( $post->ID ) ? ' has-excerpt' : '';
?>
<?php do_action( 'AHEE__content_espresso_venues_template__before_post', $post ); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'espresso-venue-details entry-content ' . $wrap_class ); ?>>

<?php if ( is_single() ) : ?>

<div id="espresso-venue-header-dv-<?php echo $post->ID;?>" class="espresso-venue-header-dv">
<?php espresso_get_template_part( 'content', 'espresso_venues-header' ); ?>
<center><?php espresso_get_template_part( 'content', 'espresso_venues-thumbnail' ); ?></center>
</div>

<div class="espresso-venue-wrapper-dv">
<?php espresso_get_template_part( 'content', 'espresso_venues-details' ); ?>
Transports : <?php echo get_field('venue_custom_transport'); ?>	
<?php espresso_get_template_part( 'content', 'espresso_venues-location' ); ?>
<footer class="venue-meta">
<?php do_action( 'AHEE__content_espresso_venues_template__footer_top', $post ); ?>
<?php do_action( 'AHEE__content_espresso_venues_template__footer_bottom', $post ); ?>
</footer>
</div>

<!-- Pour loop -->
<?php elseif ( is_archive() ) : ?>
<div id="espresso-venue-header-dv-<?php echo $post->ID;?>" class="espresso-venue-header-dv">
<center><div style="max-width:300px;"><?php espresso_get_template_part( 'content', 'espresso_venues-thumbnail' ); ?></div></center>
<?php espresso_get_template_part( 'content', 'espresso_venues-header' ); ?>
</div>
<!--
<div class="espresso-venue-wrapper-dv">
< ?php espresso_get_template_part( 'content', 'espresso_venues-details' ); ?>
</div>
-->
<?php endif; ?>

</article>
<!-- #post -->
<?php do_action( 'AHEE__content_espresso_venues_template__after_post', $post );


JacquesMivi

February 5, 2016 at 8:54 am

Do you know why ?


Josh

  • Support Staff

February 5, 2016 at 9:06 am

It doesn’t look like you really followed the guide for the venue archive template. I’ll add that you shouldn’t call the venue loop template:

<?php espresso_get_template_part( 'loop', 'espresso_venues' ); ?>

That should be changed to load the content template part instead right?


JacquesMivi

February 5, 2016 at 9:17 am

Yes I was’t sure to understand this part.

Now, I have changed “archive-espresso_venues.php” in

<?php
/**
* Template Name: Venue List
*
* This is template will display a list of your event venues 
*
* Event Registration and Management Plugin for WordPress
*
* @ package		Event Espresso
* @ author		Seth Shoultes
* @ copyright	(c) 2008-2014 Event Espresso  All Rights Reserved.
* @ license		https://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
* @ link			http://www.eventespresso.com
* @ version		EE4+
*/
get_header(); 
?>

<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
if ( have_posts() ) : 

// Start the Loop.
while ( have_posts() ) : the_post();
//  Include the post TYPE-specific template for the content.
espresso_get_template_part( 'content', 'espresso_venues' );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
comments_template();
}
endwhile;

else :
// If no content, include the "No posts found" template.
espresso_get_template_part( 'content', 'none' );
endif;
?>
</div><!-- #content -->
</section><!-- #primary -->

<?php
get_footer();


JacquesMivi

February 5, 2016 at 9:18 am

For me it’s work but is it correct ?
Thanks for you help.


Josh

  • Support Staff

February 5, 2016 at 9:37 am

I can’t really speak to whether or not it’s correct. It doesn’t follow the typical Genesis way of templating, but if you’re okay with that, more power to you.


JacquesMivi

February 5, 2016 at 1:49 pm

Yes you right. Here is a better version. Thx a lot for your support Josh.

archive-espresso_venues.php

<?php
/**
* Template Name: Venue List
*
* This is template will display a list of your event venues 
*
* Event Registration and Management Plugin for WordPress
*
* @ package		Event Espresso
* @ author		Seth Shoultes
* @ copyright	(c) 2008-2014 Event Espresso  All Rights Reserved.
* @ license		https://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
* @ link			http://www.eventespresso.com
* @ version		EE4+
*/

remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_grid_venues_loop' ); // Add custom loop
function custom_do_grid_venues_loop() {  
?>
<div class="page hentry entry">
<h1 class="entry-title"><?php get_the_title() ?></h1>
<div class="entry-content">

<?php
// Start the Loop.
while ( have_posts() ) : the_post();
//  Include the post TYPE-specific template for the content.
espresso_get_template_part( 'content', 'espresso_venues' );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
comments_template();
}
endwhile;
?>	

</div><!-- end .entry-content -->
</div><!-- end .page .hentry .entry -->
<?php
}
genesis();

The support post ‘EE4, Custom Template Archive Venue, Genesis’ 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