File: /home/frenchy/refonte2023/wordpress/wp-content/plugins/ova-dep/inc/class-ova-templates-loaders.php
<?php
if ( !defined( 'ABSPATH' ) ) {
exit;
}
class OVADEP_templates_loader {
/**
* The Constructor
*/
public function __construct() {
add_filter( 'template_include', array( $this, 'template_loader' ) );
}
public function template_loader( $template ) {
$post_type = isset($_REQUEST['post_type'] ) ? esc_html( $_REQUEST['post_type'] ) : get_post_type();
if( is_tax( 'cat_department' ) || get_query_var( 'cat_department' ) != '' ){
ovadep_get_template( 'archive-dep.php' );
return false;
}
// Is Team Post Type
if( $post_type == 'ova_dep' ){
if ( is_post_type_archive( 'ova_dep' ) ) {
ovadep_get_template( 'archive-dep.php' );
return false;
} else if ( is_single() ) {
ovadep_get_template( 'single-dep.php' );
return false;
}
}
if ( $post_type !== 'ova_dep' ){
return $template;
}
}
}
new OVADEP_templates_loader();