HEX
Server: Apache
System: Linux webd004.cluster130.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: frenchy (106757)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
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();