Support

Home Forums Event Espresso Premium Create an archive template but new events are now showing differently

Create an archive template but new events are now showing differently

Posted: October 1, 2020 at 4:30 am

Viewing 8 reply threads


InfinityBC

October 1, 2020 at 4:30 am

Hi I’ve been through – https://eventespresso.com/wiki/ee4-custom-post-types/#archive_event_template and created a new archive template. Adding a different title and a company logo.

https://www.the-ta.com/upcoming-events/

The new template has though changed the layouts of new events in the archive list.

I didn’t change any of the other code. Really stuck and scratching my head.

Here is the code form the template file below. Thanks so much in advance guys.

Regards

Mark

<?php
/**
* The template for displaying archive pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package BuddyBoss_Theme
*/

get_header();

$blog_type = ‘standard’; // standard, grid, masonry.
$blog_type = apply_filters( ‘bb_blog_type’, $blog_type );

$class = ”;

if ( ‘masonry’ === $blog_type ) {
$class = ‘bb-masonry’;
} elseif ( ‘grid’ === $blog_type ) {
$class = ‘bb-grid’;
} else {
$class = ‘bb-standard’;
}
?>

<div id=”primary” class=”content-area”>
<main id=”main” class=”site-main”>

<?php if ( have_posts() ) : ?>
<header class=”page-header”>
<?php
the_archive_title( ‘<h1 class=”page-title”>’, ‘</h1>’ );
the_archive_description( ‘<div class=”archive-description”>’, ‘</div>’ );
?>
</header><!– .page-header –>

<div class=”container”>
<table id=”notes”>
<tr>
<td>

<h2 class=”eventtitle” align=”left”><br>Upcoming Events </h2>
<div class=”notice”><?php echo wpautop( $invoice->notes ); ?></div>
</td>
<td>
<div class=”eventlogo”>
Egyption Chamber of Commerce Logo
</div></td>
</tr>
</table>

</div>

<div class=”post-grid <?php echo esc_attr( $class ); ?>”>

<?php if ( ‘masonry’ === $blog_type ) { ?>
<div class=”bb-masonry-sizer”></div>
<?php } ?>

<?php
/* Start the Loop */
while ( have_posts() ) :
the_post();

/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( ‘template-parts/content’, apply_filters( ‘bb_blog_content’, get_post_format() ) );

endwhile;
?>
</div>

<?php
buddyboss_pagination();

else :
get_template_part( ‘template-parts/content’, ‘none’ );
?>

<?php endif; ?>

</main><!– #main –>
</div><!– #primary –>

<?php get_sidebar(); ?>

<?php
get_footer();


InfinityBC

October 1, 2020 at 4:33 am

Hi I’ve been through – https://eventespresso.com/wiki/ee4-custom-post-types/#archive_event_template and created a new archive template. Adding a different title and a company logo.

https://www.the-ta.com/upcoming-events/

The new template has though changed the layouts of new events in the archive list losing the View more, date and view details.

I didn’t change any of the other code. Really stuck and scratching my head.

Here is the code form the template file below. Thanks so much in advance guys.

Regards

Mark

<?php
/**
* The template for displaying archive pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package BuddyBoss_Theme
*/

get_header();

$blog_type = ‘standard’; // standard, grid, masonry.
$blog_type = apply_filters( ‘bb_blog_type’, $blog_type );

$class = ”;

if ( ‘masonry’ === $blog_type ) {
$class = ‘bb-masonry’;
} elseif ( ‘grid’ === $blog_type ) {
$class = ‘bb-grid’;
} else {
$class = ‘bb-standard’;
}
?>

<div id=”primary” class=”content-area”>
<main id=”main” class=”site-main”>

<?php if ( have_posts() ) : ?>
<header class=”page-header”>
<?php
the_archive_title( ‘<h1 class=”page-title”>’, ‘</h1>’ );
the_archive_description( ‘<div class=”archive-description”>’, ‘</div>’ );
?>
</header><!– .page-header –>

<div class=”container”>
<table id=”notes”>
<tr>
<td>

<h2 class=”eventtitle” align=”left”><br>Upcoming Events </h2>
<div class=”notice”><?php echo wpautop( $invoice->notes ); ?></div>
</td>
<td>
<div class=”eventlogo”>
Egyption Chamber of Commerce Logo
</div></td>
</tr>
</table>

</div>

<div class=”post-grid <?php echo esc_attr( $class ); ?>”>

<?php if ( ‘masonry’ === $blog_type ) { ?>
<div class=”bb-masonry-sizer”></div>
<?php } ?>

<?php
/* Start the Loop */
while ( have_posts() ) :
the_post();

/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( ‘template-parts/content’, apply_filters( ‘bb_blog_content’, get_post_format() ) );

endwhile;
?>
</div>

<?php
buddyboss_pagination();

else :
get_template_part( ‘template-parts/content’, ‘none’ );
?>

<?php endif; ?>

</main><!– #main –>
</div><!– #primary –>

<?php get_sidebar(); ?>

<?php
get_footer();


Tony

  • Support Staff

October 1, 2020 at 4:58 am

Hi there,

Sounds like your theme may be using a different template than the one you copied.

Which template did you copy to create archive-espresso_events.php?

Rename that template to something other than the above, add a ‘2’ or ‘temp’ to the filename:

archive-espresso_events2.php or archive-espresso_events-temp.php

That will deactivate your template and switch back to whatever your theme used normally, let me know when that has been done and I’ll take a look at the page to see if anything stands out.


InfinityBC

October 1, 2020 at 5:27 am

Hi there is used the file – archive.php

I-ve changes the new template file to archive-espresso_events-temp.php

It’s taken off the Title and logo I’ve added to the template but the new test events still have the different layouts – https://www.the-ta.com/upcoming-events/

Thanks for having a look.

Regards

Mark


InfinityBC

October 1, 2020 at 6:08 am

So it can’t be the template file. Now im really scratching my head ๐Ÿ™‚


Tony

  • Support Staff

October 1, 2020 at 8:41 am

Ok, so the only change you’ve made is to copy the archive.php template and add this code:

add_filter( 'FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', '__return_true' );

to your theme’s functions.php file?

The template is currently renamed, right?

So, now comment out the above code (add // at the beginning) meaning you’ve now removed all of the modifications and then see if the output returns to how it was before?


InfinityBC

October 1, 2020 at 10:13 am

Hi,

I’m at the point again and it’s still wrong so not a template problem.

Do you have other ideas?

Its strange the old one works ok but its only new ones. I brought an old event back – Retail & E-Commerce in Egypt and that workes fin in the archive.

Thanks for your help.

Regards


Tony

  • Support Staff

October 1, 2020 at 10:36 am

Ok so this can’t be from changing the template then as all of that has now been removed.

Does your theme add options to each individual EE event when you edit the event?


InfinityBC

October 1, 2020 at 11:26 am

OK figured it out. Phew, the client was adding some text into the Excerpt and that was hijacking the Preview in Archive view.

Sorry, we went so far from that, thanks for bearing with me and getting me there.


Tony

  • Support Staff

October 1, 2020 at 11:52 am

Ahhh, yeah ok. That makes sense now.

Glad you found it ๐Ÿ™‚

Viewing 8 reply threads

The support post ‘Create an archive template but new events are now showing differently’ 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