-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfront-page.php
More file actions
executable file
·113 lines (79 loc) · 3.45 KB
/
front-page.php
File metadata and controls
executable file
·113 lines (79 loc) · 3.45 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/**
* The root level homepage
*/
get_header(); ?>
<div id="content" class="site-content">
<?php while ( have_posts() ) : the_post();
if ( 'page' == get_option( 'show_on_front' ) ) {
$thumb_url = get_the_post_thumbnail_url( $post, 'large' );
$hide_title = get_post_meta( get_the_ID(), 'hero_hide_title', true );
$contextual_text = get_post_meta( get_the_ID(), 'hero_context_text', true );
$contextual_url = get_post_meta( get_the_ID(), 'hero_context_url', true );
$custom_title = get_post_meta( get_the_ID(), 'hero_custom_title', true );
$title = $custom_title ? $custom_title : get_the_title(); // Could use 'the_title()' but this allows for override
$description = $post->post_excerpt;
$content = get_the_content();
} else {
// Fall backs if not front-page is set
$thumb_url = ''; // maybe set a default here?
$title = get_bloginfo( 'name' );
$description = get_bloginfo( 'description' );
$content = 'No front page has been set to pull content from (see <code>Settings > Reading</code>).';
}
$hero_class = $thumb_url ? 'ccl-c-hero ccl-has-search ccl-has-image' : 'ccl-c-hero ccl-has-search';
?>
<article <?php post_class(); ?>>
<div class="<?php echo esc_attr( $hero_class ); ?>" style="background-image:url(<?php echo esc_url( $thumb_url ); ?>)">
<div class="ccl-l-container">
<?php \CCL\Helpers\get_component( 'search-box' ); ?>
</div>
<div class="ccl-c-hero__thumb" style="background-image:url(<?php echo esc_url( $thumb_url ); ?>)" role="presentaion"></div>
<div class="ccl-l-container">
<?php if ( $contextual_text ) : ?>
<?php if ( $contextual_url ) : ?>
<div><a href="<?php echo $contextual_url; ?>" class="ccl-c-hero__action"><?php echo $contextual_text; ?></a></div>
<?php else : ?>
<div><span class="ccl-c-hero__action"><?php echo $contextual_text; ?></span></div>
<?php endif; ?>
<?php endif; ?>
<div class="ccl-l-row">
<?php if( ! $hide_title): ?>
<div class="ccl-l-column">
<div class="ccl-c-hero__header">
<h1 class="ccl-c-hero__title"><?php echo apply_filters( 'the_title', $title ); ?></h1>
</div>
</div>
<?php endif; //end of hiding title ?>
<?php if ( ! empty( $description ) || \CCL\Helpers\has_block_content() ) : ?>
<div class="ccl-l-column ccl-l-span-two-thirds-lg">
<div class="ccl-c-hero__content">
<?php
$hide_blocks_nav = get_post_meta( get_the_ID(), 'hero_hide_blocks_nav' );
if ( ! $hide_blocks_nav ) {
get_template_part( 'partials/block-anchors' );
}
if ( $description ) : ?>
<div class="ccl-h4 ccl-u-mt-0"><?php echo apply_filters( 'the_excerpt', $description ); ?></div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
</div>
<?php get_template_part( 'partials/quick-links' ); ?>
</div>
</div>
<?php if( !empty($content) ): ?>
<div class="ccl-l-container">
<div class="ccl-l-row">
<div class="ccl-c-entry-content ccl-l-column ccl-l-span-9-md ccl-u-my-2">
<?php echo apply_filters( 'the_content', $content ); ?>
</div>
</div>
</div>
<?php endif; ?>
<?php get_template_part( 'partials/blocks' ); ?>
</article>
<?php endwhile; ?>
</div>
<?php get_footer();