PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.0.2
Post Grid Gutenberg Blocks – PostX v2.0.2
5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 5.0.17 2.1.1 2.1.2 All 237 releases
ultimate-post / classes / Templates.php

Templates.php in Post Grid Gutenberg Blocks – PostX 2.0.2, at classes/Templates.php

30 lines 884 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ULTP;
3
4 defined('ABSPATH') || exit;
5
6 class Templates{
7 public function __construct(){
8 add_filter( 'template_include', array($this, 'set_template_callback') );
9 $post_types = get_post_types();
10 if( !empty($post_types) ){
11 foreach ($post_types as $post_type){
12 add_filter( "theme_{$post_type}_templates", array( $this, 'add_template_callback' ) );
13 }
14 }
15 }
16
17 public function set_template_callback($template){
18 if ( is_singular() ) {
19 if ( get_post_meta( get_the_ID(), '_wp_page_template', true ) === 'ultp_page_template' ) {
20 $template = ULTP_PATH . 'classes/template-without-title.php';
21 }
22 }
23 return $template;
24 }
25
26 public function add_template_callback($templates){
27 $templates['ultp_page_template'] = __('Gutenberg Post Blocks Template', 'ultimate-post');
28 return $templates;
29 }
30 }