forked from hakkens/davehakkens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent-status.php
69 lines (53 loc) · 2.25 KB
/
content-status.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
<?php $thumbnail_url = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); ?>
<div class="post-content">
<div class="post-thumbnail">
<?php the_post_thumbnail( 'full' ); ?>
</div>
<div class="date"> <?php the_time('F j, Y'); ?><br /></div>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
<div class="meta"> <div class="categories"> <?php the_category( ' ' ); ?></div>
<div class="tags"> <p><?php the_tags('', ' ', '<br />'); ?> </p></div> <?php if(function_exists('wp_ulike')) wp_ulike('get'); ?></div>
</div>
<div class="background-comments">
<div class="post-comments">
<?php comments_template(); ?>
</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>
<?php edit_post_link(); ?>