How to override archive template

How to override archive template

In order to override the Archive Template files, please follow the steps mentioned below:

  1. Copy your template file – wp-content/plugins/wp-event-manager/templates/content-event_listing_category.php
  2. Paste the file in your child theme: wp-content/themes/YOUR-THEME/wp-event-manager/content-event_listing_category.php

Enter the following code in the functions.php file

  1. add_filter( 'archive_template', 'wpem_event_archive', 20 );
  2. function wpem_event_archive($template)
  3. {
  4. if ( is_tax( 'event_listing_category' ) ) {
  5. $template = get_template_directory() . '/wp-event-manager/content-event_listing_category.php';
  6.     }
  7.     elseif ( is_tax( 'event_listing_type' ) ) { 
  8. $template = get_template_directory() . '/wp-event-manager/content-event_listing_type.php';    
  9. }
  10.     return $template;
  11. }

Or,

You can simply rename the archive template file while pasting it in the Child theme

  1. Copy your template file – wp-content/plugins/wp-event-manager/templates/content-event_listing_category.php
  2. Paste the file in your child theme: wp-content/themes/YOUR-THEME/wp-event-manager/taxonomy-event_listing_category.php (rename template).