-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage-basic-anchor-template.php
More file actions
55 lines (45 loc) · 2.09 KB
/
page-basic-anchor-template.php
File metadata and controls
55 lines (45 loc) · 2.09 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
<?php
/* Template Name: Basic Anchor Template */
get_header(); ?>
<div class="site-content">
<?php while ( have_posts() ) : the_post(); ?>
<section class="preface section <?php the_field('preface_background_color'); ?>">
<div class="section__content u-container">
<header class="section__header">
<h1 class="section-title"><?php the_title(); ?></h1>
</header>
<div class="section__body">
<div class="preface-text">
<?php the_content(); ?>
</div>
</div>
<footer class="section__footer">
<ul class="anchors u-display-flex u-flex-justify-center u-flex-wrap">
<?php while( have_rows('module') ): the_row();
$title = get_sub_field('module_title');
$module_anchor_button_title = get_sub_field('module_anchor_button_title');
$anchorButtonTitle = (!empty($module_anchor_button_title) ? $module_anchor_button_title : $title);
$moduleId = preg_replace('/\W+/', '-', strtolower($title));
?>
<li class="anchor preface-button">
<a href="#module-<?php echo $moduleId; ?>" class="button">
<?php echo $anchorButtonTitle; ?>
</a>
</li>
<?php
wp_reset_postdata();
endwhile;
?>
</ul>
</footer>
</div>
</section>
<?php
wp_reset_postdata();
endwhile;
?>
<?php if( have_rows('module') ): ?>
<?php get_template_part( 'partials/page', 'modules' ); ?>
<?php endif; ?>
</div>
<?php get_footer(); ?>