| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The Urls Redirection functionality of the plugin. |
| 5 |
* |
| 6 |
* Defines the plugin name, version, and two examples hooks for how to |
| 7 |
* enqueue the admin-specific stylesheet and JavaScript. |
| 8 |
* |
| 9 |
* @link https://searchatlas.com |
| 10 |
* @since 1.0.0 |
| 11 |
* @package Metasync |
| 12 |
* @subpackage Metasync/redirections |
| 13 |
* @author Engineering Team <support@searchatlas.com> |
| 14 |
*/ |
| 15 |
|
| 16 |
// Abort if this file is accessed directly. |
| 17 |
if (!defined('ABSPATH')) { |
| 18 |
exit; |
| 19 |
} |
| 20 |
|
| 21 |
class Metasync_Template |
| 22 |
{ |
| 23 |
const TEMPLATE_NAME = "metasync-blank"; |
| 24 |
const TEMPLATE_LABEL = "MetaSync Template"; |
| 25 |
|
| 26 |
public function metasync_getPageTemplatePath() |
| 27 |
{ |
| 28 |
return plugin_dir_path(dirname(__FILE__)) . 'templates/template-metasync-blank.php'; |
| 29 |
} |
| 30 |
|
| 31 |
public function metasync_template_landing_page($page_templates) |
| 32 |
{ |
| 33 |
$page_templates[self::TEMPLATE_NAME] = self::TEMPLATE_LABEL; |
| 34 |
return $page_templates; |
| 35 |
} |
| 36 |
|
| 37 |
public function metasync_template_landing_page_load($page_templates) |
| 38 |
{ |
| 39 |
global $post; |
| 40 |
// If the post_id is null and empty return the current template |
| 41 |
if(empty($post->ID)){ |
| 42 |
return $page_templates; |
| 43 |
} |
| 44 |
$page_template_slug = @get_page_template_slug($post->ID); |
| 45 |
if ($page_template_slug == self::TEMPLATE_NAME) |
| 46 |
return $this->metasync_getPageTemplatePath(); |
| 47 |
return $page_templates; |
| 48 |
} |
| 49 |
} |
| 50 |
|