action.php
4 years ago
api.php
5 years ago
base.php
4 years ago
hooks.php
4 years ago
templates.php
4 years ago
templates.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ShopEngine\Core\Builders; |
| 4 | |
| 5 | use ShopEngine\Core\PageTemplates\Page_Templates; |
| 6 | |
| 7 | class Templates { |
| 8 | |
| 9 | const BODY_CLASS = 'shopengine-template'; |
| 10 | |
| 11 | public static function get_template_types(): array { |
| 12 | |
| 13 | return Page_Templates::instance()->getTemplates(); |
| 14 | } |
| 15 | |
| 16 | public static function get_registered_template_id($template_type){ |
| 17 | |
| 18 | $saved_id = get_option(Action::PK__SHOPENGINE_TEMPLATE . '__' . $template_type, 0); // this can be string with '-' or int, both. |
| 19 | |
| 20 | global $wpdb; |
| 21 | $id_by_meta = $wpdb->get_results( "select post_id from $wpdb->postmeta where meta_key = 'shopengine_template_uuid' and meta_value = '$saved_id' limit 1", ARRAY_A ); |
| 22 | |
| 23 | if(isset($id_by_meta[0])){ |
| 24 | return $id_by_meta[0]; |
| 25 | } |
| 26 | |
| 27 | return (int) $saved_id; |
| 28 | } |
| 29 | } |
| 30 |