-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloop-forum copy.php
More file actions
83 lines (70 loc) · 2.53 KB
/
loop-forum copy.php
File metadata and controls
83 lines (70 loc) · 2.53 KB
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
<?php
if (get_post_type() != 'artwork') {
$artwork = false;
} else {
$artwork = true;
}
if (eas_is_edit()) {
$edit = true;
$edit_class = ' edit';
} else {
$edit = false;
$edit_class = '';
}
if (have_posts()) { ?>
<ul class="forum">
<?php /* Start loop */ ?>
<?php while (have_posts()) : the_post(); ?>
<?php roots_post_before(); ?>
<?php $assoc_id = get_post_meta($post->ID, 'assoc_id', true); ?>
<?php
if ($assoc_id && !$artwork) {
if (is_single()) {
$size = 'medium';
} else {
$size = 'thumbnail';
}
$img = eas_artwork_img($assoc_id, $size);
$src = $img[0];
?>
<figure class="forumattachment">
<a href="<?php echo eas_artwork_url($assoc_id); ?>"><img src="<?php echo $src; ?>"></a>
</figure>
<?php } ?>
<li class="forumpost<?php if ($assoc_id) echo ' forumpostattachment'; ?>">
<article <?php post_class($edit_class) ?> id="post-<?php the_ID(); ?>">
<a name="<?php echo $post->ID; ?>"></a>
<?php roots_post_inside_before(); ?>
<h5><?php eas_display_avatar($post->post_author); ?><?php the_author_meta('nickname'); ?></h5>
<?php if (!$edit) { ?>
<div class="entry-content">
<?php the_content(); ?>
</div>
<footer>
<?php wp_link_pages(array('before' => '<nav id="page-nav"><p>' . __('Pages:', 'roots'), 'after' => '</p></nav>')); ?>
<?php $tags = get_the_tags(); if ($tags) { ?><p><?php the_tags(); ?></p><?php } ?>
<?php eas_forum_meta(); ?>
<?php eas_new_post_button(true); ?>
<?php eas_edit_button(); ?>
<?php eas_feature_button(); ?>
</footer>
<?php } else { ?>
<form method="post" action="">
<input type="hidden" name="ID" value="<?php echo $post->ID; ?>">
<?php eas_editor(get_the_content(), 'postcontent', 'post_content', true); ?>
<input type="submit" class="btn btn-primary" value="Save">
</form>
<?php } ?>
<?php roots_post_inside_after(); ?>
</article>
<?php
// Get child posts if we're requesting more than one post
if ($wp_query->query_vars['posts_per_page'] != 1) {
eas_get_forum_posts($post->ID);
}
?>
</li>
<?php roots_post_after(); ?>
<?php endwhile; /* End loop */ ?>
</ul>
<?php } ?>