-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpage-full-width.php
95 lines (70 loc) · 2.45 KB
/
page-full-width.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* Template Name: Full-Width
*
* @package Hale
* @copyright Ministry of Justice
* @version 2.0
*/
$is_cat_page = false;
get_header();
flush();
while (have_posts()) :
the_post();
?>
<div id="primary" class="govuk-grid-column-full-from-desktop">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php
$show_title_section = get_post_meta($post->ID, 'hale_metabox_page_title_section', true);
if (empty($show_title_section)) {
$show_title_section = 'yes';
}
if(is_front_page() === false && $show_title_section == 'yes') { ?>
<div class="page-header-section">
<?php
/**
* Category page list section
* This loads the category list section if cat metabox is checked
*
* */
include(locate_template('partials/category-list-section.php', false, false));
// Header loads if category not selected on page
if (empty($is_cat_page)) { ?>
<h1 class="govuk-heading-xl govuk-!-static-margin-bottom-6"><?php the_title(); ?></h1>
<?php
}
?>
</div>
<?php
} elseif (is_front_page()) {
// If we are on a landing page, we need to check that an H1 is present.
// If one is not present, we need to add in a hidden one.
if (strpos(get_the_content(),"<h1") === false) {
$hidden_title = get_bloginfo("name")." – ".__("Homepage","hale");
echo "<h1 class='govuk-visually-hidden'>$hidden_title</h1>";
}
}
?>
<?php
// Page title if category selected on page
if (is_front_page() === false) {
if (!empty($is_cat_page)) {
// Add special heading CSS class depending on if category menu is activated
$hale_heading_class = $is_cat_page ? ' govuk-heading-l' : '';
echo '<h1 class="entry-title' . $hale_heading_class . '">' . get_the_title() . '</h1>';
}
}
// Page excerpt
if (has_excerpt()) {
echo '<div class="intro">' . get_the_excerpt() . '</div>';
}
// Page body content
get_template_part('template-parts/content', 'page');
// Page previous/next tabs
include(locate_template('partials/next-previous-tabs.php', false, false));
?>
</article><!-- #post-<?php the_ID(); ?> -->
</div><!-- #primary -->
<?php endwhile;
flush();
get_footer();