Skip to content

Commit 9abd445

Browse files
feat: add disclaimer section for the legal page template
1 parent eb00686 commit 9abd445

File tree

6 files changed

+217
-90
lines changed

6 files changed

+217
-90
lines changed

acf-json/group_67619372a9c81.json

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,72 @@
120120
"placeholder": "",
121121
"prepend": "",
122122
"append": ""
123+
},
124+
{
125+
"key": "field_676966a441a24",
126+
"label": "Disclaimer",
127+
"name": "disclaimer",
128+
"aria-label": "",
129+
"type": "repeater",
130+
"instructions": "",
131+
"required": 0,
132+
"conditional_logic": 0,
133+
"wrapper": {
134+
"width": "",
135+
"class": "",
136+
"id": ""
137+
},
138+
"layout": "block",
139+
"pagination": 0,
140+
"min": 0,
141+
"max": 0,
142+
"collapsed": "",
143+
"button_label": "Add paragraph",
144+
"rows_per_page": 20,
145+
"sub_fields": [
146+
{
147+
"key": "field_676966ba41a25",
148+
"label": "Title",
149+
"name": "title",
150+
"aria-label": "",
151+
"type": "text",
152+
"instructions": "",
153+
"required": 0,
154+
"conditional_logic": 0,
155+
"wrapper": {
156+
"width": "",
157+
"class": "",
158+
"id": ""
159+
},
160+
"default_value": "",
161+
"maxlength": "",
162+
"placeholder": "",
163+
"prepend": "",
164+
"append": "",
165+
"parent_repeater": "field_676966a441a24"
166+
},
167+
{
168+
"key": "field_676966cc41a26",
169+
"label": "Content",
170+
"name": "content",
171+
"aria-label": "",
172+
"type": "wysiwyg",
173+
"instructions": "",
174+
"required": 0,
175+
"conditional_logic": 0,
176+
"wrapper": {
177+
"width": "",
178+
"class": "",
179+
"id": ""
180+
},
181+
"default_value": "",
182+
"tabs": "all",
183+
"toolbar": "full",
184+
"media_upload": 0,
185+
"delay": 0,
186+
"parent_repeater": "field_676966a441a24"
187+
}
188+
]
123189
}
124190
],
125191
"location": [
@@ -142,5 +208,5 @@
142208
"active": true,
143209
"description": "",
144210
"show_in_rest": 0,
145-
"modified": 1734452852
211+
"modified": 1734961530
146212
}

build/bundle.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array(), 'version' => '41ec9ed9fecb27873916');
1+
<?php return array('dependencies' => array(), 'version' => '7645b4918c5327bf75a5');

build/css/style.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inc/translations.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@
6262
pll_register_string( 'footer', 'support the utopia', 'Polylang', true );
6363
pll_register_string( 'footer', 'support us', 'Polylang', true );
6464

65-
// Legal Notice
65+
// Legal Notice.
6666
pll_register_string( 'legal-notice', 'Represented by', 'legal-notice', true );
6767
pll_register_string( 'legal-notice', 'Registration number', 'legal-notice', true );
6868
pll_register_string( 'legal-notice', 'VAT number', 'legal-notice', true );
69+
pll_register_string( 'legal-notice', 'Haftungsausschluss (Disclaimer)', 'legal-notice', true );
6970

7071
// Dates.
7172
pll_register_string( 'date', 'Monday', 'Polylang', true );

page-legal-notice.php

Lines changed: 93 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,113 @@
11
<?php
2-
/**
3-
* Template Name: Legal Notice Template
4-
*
5-
* @package 0.0.1
6-
*/
2+
/**
3+
* Template Name: Legal Notice Template
4+
*
5+
* @package 0.0.1
6+
*/
77

8-
defined( 'ABSPATH' ) || exit;
8+
defined( 'ABSPATH' ) || exit;
99

10-
global $post;
10+
global $post;
1111

12-
$extra_classes = array();
12+
$extra_classes = array();
1313

14-
$extra_classes[] = 'post-' . $post->post_name;
14+
$extra_classes[] = 'post-' . $post->post_name;
1515

16-
get_header(
17-
null,
18-
array(
19-
'data-wf-page' => '665723f572caecd02591aa75',
20-
'barba-container-extra-classes' => 'inner-page ' . implode( ' ', $extra_classes ),
21-
'barba-namespace' => 'simple-page',
22-
)
23-
);
16+
get_header(
17+
null,
18+
array(
19+
'data-wf-page' => '665723f572caecd02591aa75',
20+
'barba-container-extra-classes' => 'inner-page ' . implode( ' ', $extra_classes ),
21+
'barba-namespace' => 'simple-page',
22+
)
23+
);
2424

25-
the_post();
26-
?>
25+
the_post();
26+
?>
2727
<div class="usual-page">
2828
<h1 class="heading"><?php the_title(); ?></h1>
2929
<div class="legal-wrapper">
30-
<?php
31-
$company = get_field( 'company' );
32-
if ( ! empty( $company ) ) :
33-
?>
34-
<div class="legal-wrapper__item">
35-
<p><?php echo $company; ?></p>
36-
</div>
37-
<?php endif; ?>
38-
<?php
39-
$representative = get_field( 'representative' );
40-
if ( ! empty( $representative ) ) :
41-
?>
42-
<div class="legal-wrapper__item">
43-
<strong><?php pll_e( 'Represented by' ); ?></strong>
44-
<p><?php echo $representative; ?></p>
45-
</div>
30+
<?php
31+
$company = get_field( 'company' );
32+
if ( ! empty( $company ) ) :
33+
?>
34+
<div class="legal-wrapper__item">
35+
<p><?php echo $company; ?></p>
36+
</div>
37+
<?php endif; ?>
38+
<?php
39+
$representative = get_field( 'representative' );
40+
if ( ! empty( $representative ) ) :
41+
?>
42+
<div class="legal-wrapper__item">
43+
<strong><?php pll_e( 'Represented by' ); ?></strong>
44+
<p><?php echo $representative; ?></p>
45+
</div>
46+
<?php endif; ?>
47+
<?php
48+
$registration_number = get_field( 'registration_number' );
49+
if ( ! empty( $registration_number ) ) :
50+
?>
51+
<div class="legal-wrapper__item">
52+
<strong><?php pll_e( 'Registration number' ); ?></strong>
53+
<p><?php echo $registration_number; ?></p>
54+
</div>
55+
<?php endif; ?>
56+
<?php
57+
$vat_number = get_field( 'vat_number' );
58+
if ( ! empty( $vat_number ) ) :
59+
?>
60+
<div class="legal-wrapper__item">
61+
<strong><?php pll_e( 'VAT number' ); ?></strong>
62+
<p><?php echo $vat_number; ?></p>
63+
</div>
64+
<?php endif; ?>
65+
<?php
66+
$email = get_field( 'email' );
67+
$phone = get_field( 'phone' );
68+
if ( ! empty( $email ) || ! empty( $phone ) ) :
69+
?>
70+
<div class="legal-wrapper__item">
71+
<?php if ( ! empty( $phone ) ) : ?>
72+
<p><strong>Tel </strong><a href="<?php echo esc_url( utopia_format_phone_link( $phone ) ); ?>"><?php echo esc_html( $phone ); ?></a></p>
73+
<?php endif; ?>
74+
<?php if ( ! empty( $email ) ) : ?>
75+
<p><strong>Email </strong><a href="<?php echo esc_url( utopia_format_email_link( $email ) ); ?>"><?php echo esc_html( $email ); ?></a></p>
76+
<?php endif; ?>
77+
</div>
4678
<?php endif; ?>
4779
<?php
48-
$registration_number = get_field( 'registration_number' );
49-
if ( ! empty( $registration_number ) ) :
80+
$disclaimer = get_field( 'disclaimer' );
81+
if ( ! empty( $disclaimer ) ) :
5082
?>
51-
<div class="legal-wrapper__item">
52-
<strong><?php pll_e( 'Registration number' ); ?></strong>
53-
<p><?php echo $registration_number; ?></p>
83+
<div class="legal-disclaimer">
84+
<h2 class="legal-disclaimer__title"><?php pll_e( 'Haftungsausschluss (Disclaimer) ' ); ?></h2>
85+
<div class="legal-disclaimer__content">
86+
<?php foreach ( $disclaimer as $item ) : ?>
87+
<div class="legal-disclaimer__content-item">
88+
<h3 class="legal-disclaimer__content-title"><?php echo esc_html( $item['title'] ); ?></h3>
89+
<?php
90+
$content = $item['content'];
91+
$dom = new DOMDocument();
92+
$dom->loadHTML( mb_convert_encoding( $content, 'HTML-ENTITIES', 'UTF-8' ) );
93+
$ps = $dom->getElementsByTagName( 'p' );
94+
foreach ( $ps as $p ) {
95+
$class = $p->getAttribute( 'class' );
96+
$p->setAttribute( 'class', $class ? $class . ' legal-disclaimer__content-text' : 'legal-disclaimer__content-text' );
97+
}
98+
echo wp_kses_post( $dom->saveHTML() );
99+
?>
100+
</div>
101+
<?php endforeach; ?>
102+
</div>
54103
</div>
55104
<?php endif; ?>
56-
<?php
57-
$vat_number = get_field( 'vat_number' );
58-
if ( ! empty( $vat_number ) ) :
59-
?>
60-
<div class="legal-wrapper__item">
61-
<strong><?php pll_e( 'VAT number' ); ?></strong>
62-
<p><?php echo $vat_number; ?></p>
63105
</div>
64-
<?php endif; ?>
106+
65107
<?php
66-
$email = get_field( 'email' );
67-
$phone = get_field( 'phone' );
68-
if ( ! empty( $email ) || ! empty( $phone ) ) :
108+
get_template_part(
109+
'inc/components/footer',
110+
);
69111
?>
70-
<div class="legal-wrapper__item">
71-
<?php if ( ! empty( $phone ) ) : ?>
72-
<p><strong>Tel </strong><a href="<?php echo esc_url( utopia_format_phone_link( $phone ) ); ?>"><?php echo esc_html( $phone ); ?></a></p>
73-
<?php endif; ?>
74-
<?php if ( ! empty( $email ) ) : ?>
75-
<p><strong>Email </strong><a href="<?php echo esc_url( utopia_format_email_link( $email ) ); ?>"><?php echo esc_html( $email ); ?></a></p>
76-
<?php endif; ?>
77-
</div>
78-
<?php endif; ?>
79-
</div>
80-
<?php
81-
get_template_part(
82-
'inc/components/footer',
83-
);
84-
?>
85112
</div>
86113
<?php get_footer(); ?>

src/styles/pages/_legal.scss

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,57 @@
11
.legal-wrapper {
2-
padding-top: 109rem;
3-
padding-bottom: 84rem;
4-
width: 100%;
5-
max-width: 642rem;
6-
margin-inline: auto;
7-
display: flex;
8-
flex-direction: column;
9-
row-gap: 54rem;
10-
font-size: 24rem;
11-
line-height: 28.8rem;
2+
padding-top: 109rem;
3+
padding-bottom: 84rem;
4+
width: 100%;
5+
max-width: 642rem;
6+
margin-inline: auto;
7+
display: flex;
8+
flex-direction: column;
9+
row-gap: 54rem;
10+
font-size: 24rem;
11+
line-height: 28.8rem;
1212

13-
strong {
14-
font-weight: 400;
15-
color: #757575;
16-
}
13+
strong {
14+
font-weight: 400;
15+
color: #757575;
16+
}
1717

18-
@include mobile {
19-
padding-top: 57rem;
20-
padding-right: 24rem;
21-
font-size: 20rem;
22-
line-height: 24rem;
23-
}
18+
@include mobile {
19+
padding-top: 57rem;
20+
padding-right: 24rem;
21+
font-size: 20rem;
22+
line-height: 24rem;
23+
}
24+
}
25+
26+
.legal-disclaimer {
27+
display: grid;
28+
row-gap: 30rem;
29+
30+
&__title {
31+
font-size: 24rem;
32+
line-height: 28.8rem;
33+
font-weight: 400;
34+
color: #757575;
35+
}
36+
37+
&__content {
38+
display: grid;
39+
row-gap: 30rem;
40+
41+
&-item {
42+
display: grid;
43+
row-gap: 10rem;
44+
}
45+
46+
&-title {
47+
margin: 0;
48+
font-size: 24rem;
49+
line-height: 28.8rem;
50+
font-weight: 400;
51+
}
52+
53+
&-text {
54+
margin: 0;
55+
}
56+
}
2457
}

0 commit comments

Comments
 (0)