Your IP : 216.73.216.0
<?php
namespace Layerdrops\Zeinet;
class Utility
{
public function __construct()
{
$this->register_image_size();
add_filter('single_template', [$this, 'load_portfolio_template']);
add_filter('single_template', [$this, 'load_service_template']);
}
public function register_image_size()
{
add_image_size('zeinet_blog_370X336', 370, 336, true); // in use
add_image_size('zeinet_movie_270X390', 270, 390, true); // in use
add_image_size('zeinet_movie_270X247', 270, 247, true); // in use
add_image_size('zeinet_movie_555X389', 555, 389, true); // in use
add_image_size('zeinet_movie_570X524', 570, 524, true); // in use
add_image_size('zeinet_movie_570X300', 570, 300, true); // in use
add_image_size('zeinet_movie_370X300', 370, 300, true); // in use
add_image_size('zeinet_brand_logo_194X58', 194, 58, true); // in use
}
public function load_portfolio_template($template)
{
global $post;
if ('portfolio' === $post->post_type && locate_template(array('single-portfolio.php')) !== $template) {
/*
* This is a 'portfolio' post
* AND a 'single portfolio template' is not found on
* theme or child theme directories, so load it
* from our plugin directory.
*/
return ZEINET_ADDON_PATH . '/post-templates/single-portfolio.php';
}
return $template;
}
public function load_service_template($template)
{
global $post;
if ('service' === $post->post_type && locate_template(array('single-service.php')) !== $template) {
/*
* This is a 'service' post
* AND a 'single service template' is not found on
* theme or child theme directories, so load it
* from our plugin directory.
*/
return ZEINET_ADDON_PATH . '/post-templates/single-service.php';
}
return $template;
}
}