forked from hakkens/davehakkens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.php
92 lines (72 loc) · 2.65 KB
/
content.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
<?php $thumbnail_url = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); ?>
<div style="background-image: url('<?= $thumbnail_url; ?>');" class="thumbnail">
<div class="shadow"></div>
<div class="meta">
<h1><?php the_title(); ?></h1>
</div>
</div>
<div class="post-content">
<div class="authorinfo"> <p>
<div class="avatar"><?php echo get_avatar( get_the_author_meta( 'ID' ), 32 ); ?> </div>
<div class="author"> <?php the_author(); ?> </div>
<div class="date"> <?php the_time('F j, Y'); ?></p></div>
</div>
<?php the_content(); ?>
<div class="meta">
<div class="tags"> <p>
<?php
if($catID!= ''){
foreach (get_the_tags() as $tag){
echo ' #' . $tag->name . ' ';
}
} else {
foreach (get_the_tags() as $tag){
echo ' <a href="/tag/' . $tag->name . '">#' . $tag->name . '</a>';
}
}
?>
</p></div> <?php if(function_exists('wp_ulike')) wp_ulike('get'); ?></div>
</div>
</div>
<div class="randomtitle">
<img src="http://davehakkens.nl/wp-content/themes/davehakkens2/img/randomnews.png" alt="randomnews" height="102" width="500"></div>
<div class="other-updates">
<div class="relatedposts">
<?php
// Default arguments
$args = array(
'posts_per_page' => 4, // How many items to display
'post__not_in' => array( get_the_ID() ), // Exclude current post
'no_found_rows' => true, // We don't ned pagination so this speeds up the query
);
// Check for current post category and add tax_query to the query arguments
$cats = wp_get_post_terms( get_the_ID(), 'category' );
$cats_ids = array();
foreach( $cats as $wpex_related_cat ) {
$cats_ids[] = $wpex_related_cat->term_id;
}
if ( ! empty( $cats_ids ) ) {
$args['category__in'] = $cats_ids;
}
// Query posts
$wpex_query = new wp_query( $args );
// Loop through posts
foreach( $wpex_query->posts as $post ) : setup_postdata( $post ); ?>
<li><div class="relatedthumb"><a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail( 'thumbnail' ); ?></a></div>
<div class="relatedcontent">
</div>
</li>
<?php
// End loop
endforeach;
// Reset post data
wp_reset_postdata(); ?>
</div>
</div>
<div class="background-comments">
<div class="post-comments">
<?php comments_template(); ?>
</div>
</div>
</div>
<?php edit_post_link(); ?>