-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpage.php
38 lines (33 loc) · 1.2 KB
/
page.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
*
* Page template
*
* Checks pagename in WP query_var.
* Looks for template based on pagename.
* Looks for original languages pagename template if WPML plugin installed.
* Falls back to standard get_template_part.
*
* @package Tofino
* @since 1.0.0
*/
use \Tofino\Helpers as h;
get_header();
$template = h\get_page_name();
$post_parent = get_post_parent(get_the_ID());
if (is_front_page()) {
get_template_part('templates/content-page-front');
} else if ($post_parent && locate_template('templates/content-parent-page-' . $post_parent->post_name . '.php')) {
get_template_part('templates/content-parent-page', $post_parent->post_name);
} else if (locate_template('templates/content-page-' . $template . '.php') != '') {
get_template_part('templates/content-page', $template); // e.g. templates/content-page-members.php
} else {
if (function_exists('icl_object_id')) { //WPML installed
$original_page_id = apply_filters('wpml_object_id', get_the_ID(), 'page', false, 'en'); //Assumes english is the primary language.
if ($original_page_id) {
$template = h\get_page_name($original_page_id);
}
}
get_template_part('templates/content-page', $template);
}
get_footer(); ?>