forked from okfde/jh-lauch-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
executable file
·121 lines (108 loc) · 4.19 KB
/
single.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
<?php
/**
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package Lauch
*/
get_header();
while ( have_posts() ) :
the_post(); ?>
<section>
<div class="c-page-alpaca-header p-r">
<div class="c-page-alpaca-featured addon addon--<?php the_field('illustration_class'); ?> addon--large addon--<?php the_field('illustration_xaxis'); ?> addon--<?php the_field('illustration_yaxis'); ?>">
<?php if (get_the_post_thumbnail_url($post->ID, 'blog-alpaka')): ?>
<img src="<?php echo get_the_post_thumbnail_url($post->ID, 'blog-alpaka'); ?>" alt="" class="clip-alpaka">
<?php else : ?>
<img src="https://jugendhackt.org/wp-content/uploads/2019/10/ueber-jh-560x560.jpg" alt="" class="clip-alpaka">
<?php endif ?>
</div>
<div class="c-page-alpaca-title large">
<nav class="c-breadcrumb" aria-label="breadcrumb">
<ol>
<?php $blog = get_option( 'page_for_posts' ); ?>
<li>
<a href="<?php echo get_post_permalink($blog); ?>"><?php echo get_the_title($blog); ?></a>
</li>
</ol>
</nav>
<?php the_title('<h1 class="c-page-title">', '</h1>')?>
<?php if (get_field('contact_person') && get_field('contact_person') != '') : ?>
<div class="c-author">
<?php
$person = get_field('contact_person');
$img = get_the_post_thumbnail_url( $person, array(50, 50) );
?>
<img src="<?php echo $img ?>" alt="Bild von <?php echo get_the_title($person); ?>" class="c-author-image" width="75">
<div class="c-author-text">
<p>von <?php echo get_the_title($person); ?><br>
<time datetime="<?php echo get_the_date( 'Y-m-j'); ?>">
<?php echo get_the_date('j. F Y'); ?></time></p>
</div>
</div>
<?php endif ?>
</div>
<?php if (get_field('illustration_right')) : ?>
<div class="c-page-header-illustration right-bottom">
<img src="<?php echo get_field('illustration_right'); ?>" alt="" width="200">
</div>
<?php endif ?>
</div>
<div class="c-page-section white">
<div class="c-page-standard wp-styles">
<div class="c-page-capital-first"><?php the_content(); ?></div>
</div>
<aside class="c-page-slim">
<?php
if (get_field('contact_person') && get_field('contact_person') != '') {
echo do_shortcode("[contactperson person='". get_field('contact_person') ."']");
}
?>
<?php $terms = wp_get_post_tags($post->ID);
if ($terms) : ?>
<hr>
<div class="c-tags mt-2">
<h4 class="c-tag-title"><?php echo _("Tags", "lauch"); ?></h4>
<ul class="c-tag-list d-f mt-1">
<?php
foreach ($terms as $t): ?>
<li><a href="<?php echo get_term_link($t, 'tag'); ?>"
class="c-tag"
title=""><?php echo $t->name; ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
</aside>
</div>
</section>
<section class=" pt-5">
<h2 class="ta-c pb-2 c-uppercase-title"><?php echo _('Weitere Posts zum Thema', 'lauch'); ?></h2>
<?php
$args = array('post_type' => 'post',
'posts_per_page' => 2,
'post__not_in' => array($post->ID),
'orderby' => 'rand',
'tax-query' => array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array(get_the_category()[0]->slug)
)));
$the_query = new WP_Query( $args ); ?>
<?php if ( $the_query->have_posts() ) : ?>
<ul class="c-page-3col c-blog-list is-grid">
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<li>
<?php get_template_part( 'template-parts/content', 'teaser'); ?>
</li>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
</ul>
<?php endif; ?>
</section>
<?php
endwhile; ?>
<?php
get_footer();