|
1 | 1 | <?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 | + */ |
7 | 7 |
|
8 |
| -defined( 'ABSPATH' ) || exit; |
| 8 | + defined( 'ABSPATH' ) || exit; |
9 | 9 |
|
10 |
| -global $post; |
| 10 | + global $post; |
11 | 11 |
|
12 |
| -$extra_classes = array(); |
| 12 | + $extra_classes = array(); |
13 | 13 |
|
14 |
| -$extra_classes[] = 'post-' . $post->post_name; |
| 14 | + $extra_classes[] = 'post-' . $post->post_name; |
15 | 15 |
|
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 | + ); |
24 | 24 |
|
25 |
| -the_post(); |
26 |
| -?> |
| 25 | + the_post(); |
| 26 | + ?> |
27 | 27 | <div class="usual-page">
|
28 | 28 | <h1 class="heading"><?php the_title(); ?></h1>
|
29 | 29 | <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> |
46 | 78 | <?php endif; ?>
|
47 | 79 | <?php
|
48 |
| - $registration_number = get_field( 'registration_number' ); |
49 |
| - if ( ! empty( $registration_number ) ) : |
| 80 | + $disclaimer = get_field( 'disclaimer' ); |
| 81 | + if ( ! empty( $disclaimer ) ) : |
50 | 82 | ?>
|
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> |
54 | 103 | </div>
|
55 | 104 | <?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 | 105 | </div>
|
64 |
| - <?php endif; ?> |
| 106 | + |
65 | 107 | <?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 | + ); |
69 | 111 | ?>
|
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 |
| - ?> |
85 | 112 | </div>
|
86 | 113 | <?php get_footer(); ?>
|
0 commit comments