-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.php
222 lines (192 loc) · 9.88 KB
/
home.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<?php /* Template Name: Hem */ ?>
<?php get_header(); ?>
<div id="gde-news-module-outer-wrapper">
<div class="gde-news-module-wrapper">
<h1><?php the_field('nyhetsrubrik');?></h1>
<h3><?php the_field('nyhet-subheading');?></h3>
<div class="god-news-module-row row">
<div class="gde-news-module-starring col-lg">
<?php
$args = array(
'posts_per_page' => '1',
'post_status' => ' publish, private',
'post_type' => 'nyheter' );
$the_query = new WP_Query( $args );
if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php if( get_field('featured-news') ) : ?>
<div class="gde-news-box">
<div id="gde-news-box-thumbnail">
<?php if (has_post_thumbnail($recent['ID']) ): ?>
<div id="gde-news-box-thumbnail-date-wrapper">
<div id="gde-news-box-thumbnail-date">
<p>I blickfånget</p>
</div>
</div>
<?php endif ?>
<?php echo get_the_post_thumbnail($recent['ID'],'featured-large', 'alt=Nyhetsbild') ?>
</div>
<p class="gde-news-box-date">
<?php echo get_the_date('j F Y') ?>
</p>
<h2>
<a href="<?php echo get_permalink($recent['ID']) ?>" title="<?php echo esc_attr(the_title())?>">
<?php the_title(); ?>
</a>
</h2>
<div class="gde-news-box-excerpt">
<?php echo force_balance_tags(html_entity_decode(wp_trim_words(htmlentities(get_the_content()), 80, '...')))?>
</div>
<a class="gde-news-box-button-link" href="<?php echo get_permalink($recent['ID']) ?>">
<button class="button button-solid">Läs hela artikeln</button>
</a>
</div>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
<div class="gde-news-module-aside col-lg">
<?php
$args = array( 'posts_per_page' => '4',
'post_status' => ' publish, private',
'post_type' => 'nyheter' );
$the_query = new WP_Query( $args );
if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="gde-news-box">
<p class="gde-news-box-date">
<?php echo get_the_date('j F Y'); ?>
</p>
<h2>
<a href="<?php echo get_permalink($recent['ID']) ?>" title="<?php echo esc_attr($recent["post_title"])?>">
<?php the_title()?>
</a>
<?php if( get_field('featured-news') ) : ?>
<span class="gde-featured-badge">I blickfånget</span>
<?php endif; ?>
</h2>
<div class="gde-news-box-excerpt">
<?php echo wpautop(wp_trim_words(get_the_content(), 20))?>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
<div class="gde-modules-readmore">
<a href="nyheter/">
<p class="gde-readmore-text">Läs flera nyheter</p>
<img src="<?php bloginfo('template_directory'); ?>/assets/icons/angle-right.svg" class="readmore-icon" alt="Högerpil" />
</a>
</div>
</div>
</div>
</div>
</div>
<div id="gde-sections-modules-outer-wrapper">
<div class="row gde-sections-modules-wrapper">
<div class="gde-links-module-wrapper col-lg">
<h1><?php the_field('lankar-rubrik');?></h1>
<h3><?php the_field('lankar-underrubrik');?></h3>
<!-- Get the link-list for all the links and strip the http-protocol -->
<?php $loop = new WP_Query( array(
'post_type' => 'links',
'posts_per_page' => 5,
'meta_query' => array(
array(
'key' => 'startpage_link',
'value' => '1',
'compare' => '=='
)
)
) );
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="gde-links-module-box-wrapper">
<div class="gde-links-module-box">
<div class="gde-links-module-info">
<div class="gde-links-module-url">
<a href="<?php the_field('link_url');?>" target="_blank">
<h4><?php echo the_title(); ?></h4>
</a>
</div>
<div class="gde-links-module-description"><p><?php the_field('link_desc');?></p></div>
</div>
<div class="gde-links-module-icon">
<a href="<?php the_field('link_url');?>" target="_blank">
<img src="<?php bloginfo('template_directory'); ?>/assets/icons/external-icon.svg" class="external-icon" alt="Högerpil" />
</a>
</div>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
<div class="gde-modules-readmore">
<a href="lankar/">
<p class="gde-readmore-text">Se alla våra länkar</p>
<img src="<?php bloginfo('template_directory'); ?>/assets/icons/angle-right.svg" class="readmore-icon" alt="Högerpil" />
</a>
</div>
</div>
<div class="gde-events-module-wrapper col-lg">
<h1><?php the_field('handelserubrik');?></h1>
<h3><?php the_field('handelser-subheading');?></h3>
<!-- Get the events-list for all the events -->
<?php $loop2 = new WP_Query( array(
'post_type' => 'el_events',
'posts_per_page' => 5,
'meta_key' => 'startdate',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'startdate',
'value' => date('Y-m-d'),
'compare' => '>'
),
array(
'key' => 'enddate',
'value' => date('Y-m-d'),
'compare' => '>'
)
),
'orderby' => 'meta_value',
'order' => 'ASC',
)); ?>
<?php while ( $loop2->have_posts() ) : $loop2->the_post(); ?>
<?php
$startDate = get_field('startdate');
$startDateE = date_i18n("d M Y", strtotime($startDate));
$startDateF = date_i18n("d M ", strtotime($startDate));
$endDate = get_field('enddate');
$endDateF = date_i18n("d M Y", strtotime($endDate));
?>
<div class="gde-events-module-box-wrapper">
<div class="gde-events-module-box row">
<div class="gde-events-module-date col-lg-4">
<p><?php if ( $startDate === $endDate) {
echo $startDateE;
} else if ($startDateF !== $endDateF && !strncmp($startDateF, $endDateF)) {
echo $startDateF .' - '. $endDateF;
} ?></p>
</div>
<div class="gde-events-module-content col-lg-7">
<a href="<?php the_field('location');?>">
<div class="gde-events-module-title">
<h4><?php the_title(); ?></h4>
</div>
</a>
<div class="gde-events-module-info">
<?php the_content(); ?>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
<div class="gde-modules-readmore">
<a href="handelser/">
<p class="gde-readmore-text">Se alla våra händelser</p>
<img src="<?php bloginfo('template_directory'); ?>/assets/icons/angle-right.svg" class="readmore-icon" alt="Högerpil" />
</a>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>