page.php
79 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Template Name: Full-width page layout |
| 5 | * Template Post Type: page, post |
| 6 | * |
| 7 | * @package kirki |
| 8 | */ |
| 9 | |
| 10 | use Kirki\Frontend\Preview\Preview; |
| 11 | use Kirki\HelperFunctions; |
| 12 | // use Kirki\View; |
| 13 | |
| 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | exit; |
| 16 | } |
| 17 | |
| 18 | $custom_data = get_query_var('kirki_custom_data' ); |
| 19 | $the_content = false; |
| 20 | $meta_tags = false; |
| 21 | |
| 22 | $template_data = HelperFunctions::get_template_data_if_current_page_is_kirki_template(); |
| 23 | if ( $template_data ) { |
| 24 | $the_content = $template_data['content']; |
| 25 | } else { |
| 26 | // this is for Kirki utility page |
| 27 | $custom_post_data = HelperFunctions::get_custom_data_if_current_page_is_kirki_custom_post(); |
| 28 | if ( $custom_post_data ) { |
| 29 | $the_content = $custom_post_data['content']; |
| 30 | $custom_post_id = $custom_post_data['post_id']; |
| 31 | |
| 32 | $meta_tags = Preview::getSeoMetaTags( $custom_post_id ); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | global $kirki_custom_header, $kirki_custom_footer; // this will set from TemplateRedirection.php class |
| 37 | $theme_dir = get_template_directory(); |
| 38 | ?> |
| 39 | |
| 40 | <?php |
| 41 | $has_header = file_exists( get_stylesheet_directory() . '/header.php' ) || file_exists( get_template_directory() . '/header.php' ); |
| 42 | if ( ! $kirki_custom_header && $has_header ) { |
| 43 | get_header(); |
| 44 | } else { |
| 45 | ?> |
| 46 | <!DOCTYPE html> |
| 47 | <html <?php language_attributes(); ?>> |
| 48 | |
| 49 | <head> |
| 50 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 51 | <?php wp_head(); ?> |
| 52 | <?php |
| 53 | if ( $meta_tags ) { |
| 54 | echo $meta_tags; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 55 | } |
| 56 | ?> |
| 57 | </head> |
| 58 | <body> |
| 59 | <?php } ?> |
| 60 | <?php do_action( 'wp_body_open' ); ?> |
| 61 | <?php |
| 62 | if ( $the_content ) { |
| 63 | $the_content = do_shortcode( $the_content ); |
| 64 | // View::echo_safe_html( $the_content ); |
| 65 | echo $the_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 66 | } else { |
| 67 | the_content(); |
| 68 | } |
| 69 | ?> |
| 70 | <?php |
| 71 | $has_footer = file_exists( get_stylesheet_directory() . '/footer.php' ) || file_exists( get_template_directory() . '/footer.php' ); |
| 72 | if ( ! $kirki_custom_footer && $has_footer ) { |
| 73 | get_footer(); |
| 74 | } else { |
| 75 | wp_footer(); |
| 76 | ?> |
| 77 | </body> |
| 78 | <?php } ?> |
| 79 |