page.php
77 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 | if ( ! $kirki_custom_header && locate_template( 'header.php' ) ) { |
| 42 | get_header(); |
| 43 | } else { |
| 44 | ?> |
| 45 | <!DOCTYPE html> |
| 46 | <html <?php language_attributes(); ?>> |
| 47 | |
| 48 | <head> |
| 49 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 50 | <?php wp_head(); ?> |
| 51 | <?php |
| 52 | if ( $meta_tags ) { |
| 53 | echo $meta_tags; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 54 | } |
| 55 | ?> |
| 56 | </head> |
| 57 | <body> |
| 58 | <?php } ?> |
| 59 | <?php do_action( 'wp_body_open' ); ?> |
| 60 | <?php |
| 61 | if ( $the_content ) { |
| 62 | $the_content = do_shortcode( $the_content ); |
| 63 | // View::echo_safe_html( $the_content ); |
| 64 | echo $the_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 65 | } else { |
| 66 | the_content(); |
| 67 | } |
| 68 | ?> |
| 69 | <?php |
| 70 | if ( ! $kirki_custom_footer && locate_template( 'footer.php' ) ) { |
| 71 | get_footer(); |
| 72 | } else { |
| 73 | wp_footer(); |
| 74 | ?> |
| 75 | </body> |
| 76 | <?php } ?> |
| 77 |