| 1 |
<?php |
| 2 |
// Exit if accessed directly |
| 3 |
if( !defined( 'ABSPATH' ) ) exit; |
| 4 |
?> |
| 5 |
|
| 6 |
<div class="wpfl-1 wpforo-section"> |
| 7 |
<div class="wpforo-topic-head"> |
| 8 |
<div class="head-title"><?php wpforo_phrase('Topic title') ?></div> |
| 9 |
<div class="head-stat-views"><?php wpforo_phrase('Views') ?></div> |
| 10 |
<div class="head-stat-posts"><?php wpforo_phrase('Posts') ?></div> |
| 11 |
<br class="wpf-clear"> |
| 12 |
</div> |
| 13 |
|
| 14 |
<?php foreach($topics as $key => $topic) : ?> |
| 15 |
|
| 16 |
<?php |
| 17 |
$member = wpforo_member($topic); |
| 18 |
if(isset($topic['last_post']) && $topic['last_post'] != 0){ |
| 19 |
$last_post = wpforo_post($topic['last_post']); |
| 20 |
$last_poster = wpforo_member($last_post); |
| 21 |
} |
| 22 |
if(isset($topic['first_postid']) && $topic['first_postid'] != 0){ |
| 23 |
$first_post = wpforo_post($topic['first_postid']); |
| 24 |
$intro_posts = wpforo_setting( 'topics', 'layout_extended_intro_posts_count' ); if( $intro_posts < 1 ){ $intro_posts = NULL; } else { $intro_posts = ($intro_posts > 1) ? ($intro_posts - 1) : $intro_posts = 0; } |
| 25 |
$first_poster = wpforo_member($first_post); |
| 26 |
$posts = WPF()->post->get_posts( array('topicid' => $topic['topicid'], 'exclude' => $topic['first_postid'], 'orderby' => '`is_first_post` ASC, `created` DESC, `postid` DESC', 'row_count' => $intro_posts) ); |
| 27 |
$posts = array_reverse($posts); |
| 28 |
} |
| 29 |
$topic_url = wpforo_topic($topic['topicid'], 'url'); |
| 30 |
$post_toglle = wpforo_setting( 'topics', 'layout_extended_intro_posts_toggle' ); |
| 31 |
?> |
| 32 |
|
| 33 |
<div class="topic-wrap <?php wpforo_topic_types( $topic ); wpforo_unread($topic['topicid'], 'topic'); ?>"> |
| 34 |
<div class="wpforo-topic"> |
| 35 |
<div class="wpforo-topic-info"> |
| 36 |
<p class="wpforo-topic-title"><?php wpforo_topic_title($topic, $topic_url, '{i}{p}{au}{t}{/a}{n}{v}') ?></p> |
| 37 |
<p class="wpforo-topic-start-info wpfcl-1"> |
| 38 |
<span class="wpfcl-5"><?php wpforo_phrase('First post and replies') ?></span> <i id="button-arrow-<?php echo intval($topic['topicid']) ?>" class="topictoggle wpfcl-a fas fa-chevron-<?php echo ( $post_toglle == 1 ? 'up' : 'down' ) ?>"></i> |
| 39 |
<?php if(isset($last_post) && !empty($last_post)) : ?> |
| 40 |
<span class="wpf-vsep">|</span> |
| 41 |
<span class="wpf-last-post-by"><a href="<?php echo esc_url( (string) $last_post['url'] ) ?>"><?php echo sprintf( wpforo_phrase('Last post by %s', FALSE), $last_poster['display_name'] ) ?><span class="wpforo-date wpforo-date-ago">, <?php wpforo_date($last_post['created']); ?></span> <i class="fas fa-chevron-right fa-sx wpfcl-a"></i></a></span> |
| 42 |
<?php endif; ?> |
| 43 |
</p> |
| 44 |
<div class="wpforo-topic-badges"><?php do_action('wpforo_topic_info_end', $topic); ?></div> |
| 45 |
</div> |
| 46 |
<div class="wpforo-topic-stat-views"><?php echo intval($topic['views']) ?></div> |
| 47 |
<div class="wpforo-topic-stat-posts"><?php echo intval($topic['posts']) ?></div> |
| 48 |
<br class="wpf-clear"> |
| 49 |
</div><!-- wpforo-topic --> |
| 50 |
<div class="wpforo-last-posts-<?php echo intval($topic['topicid']) ?>" style="display: <?php echo ( $post_toglle == 1 ? 'block' : 'none' ); ?>"> |
| 51 |
<div class="wpforo-last-posts-list"> |
| 52 |
<ul> |
| 53 |
<li> |
| 54 |
<div class="wpforo-last-post-title"><i class="fas fa-feather-alt wpfsx wpfcl-0"></i> <a href="<?php echo esc_url((string) $first_post['url']) ?>"><?php echo esc_html( wpforo_text($first_post['body'], wpforo_setting( 'topics', 'layout_extended_intro_posts_length' ), false)) ?></a></div> |
| 55 |
<div class="wpforo-last-post-user"><?php wpforo_member_link($first_poster, 'by %s', 9); ?> <?php wpforo_date($first_post['created']); ?></div> |
| 56 |
<br class="wpf-clear"> |
| 57 |
</li> |
| 58 |
<?php if(!empty($posts) && is_array($posts)) : ?> |
| 59 |
<?php foreach($posts as $post) : ?> |
| 60 |
<?php $poster = wpforo_member($post); ?> |
| 61 |
<li> |
| 62 |
<div class="wpforo-last-post-title"><i class="fas fa-reply fa-rotate-180 wpfsx wpfcl-0"></i> <a href="<?php echo esc_url( (string) wpforo_post($post['postid'], 'url') ); ?>" title="<?php wpforo_phrase('REPLY:') ?> <?php echo esc_html( wpforo_text($post['body'], 100, false)) ?>"><?php echo (( $post_body = esc_html(wpforo_text($post['body'], wpforo_setting( 'topics', 'layout_extended_intro_posts_length' ), FALSE)) ) ? $post_body : esc_html($post['title'])) ?></a></div> |
| 63 |
<div class="wpforo-last-post-user"><?php wpforo_member_link($poster, 'by %s', 9); ?> <?php wpforo_date($post['created']); ?></div> |
| 64 |
<br class="wpf-clear"> |
| 65 |
</li> |
| 66 |
<?php endforeach ?> |
| 67 |
<?php if(intval($topic['posts']) > ($intro_posts+1)): ?> |
| 68 |
<li class="wpforo-last-post-more"><a href="<?php echo esc_url((string) $topic_url) ?>"><?php wpforo_phrase('view all posts', true, 'lower'); ?> <i class="fas fa-angle-right" aria-hidden="true"></i></a></li> |
| 69 |
<?php endif ?> |
| 70 |
<?php endif ?> |
| 71 |
</ul> |
| 72 |
</div><!-- wpforo-last-posts-list --> |
| 73 |
<br class="wpf-clear"> |
| 74 |
</div><!-- wpforo-last-posts --> |
| 75 |
</div> |
| 76 |
|
| 77 |
<?php do_action( 'wpforo_loop_hook', $key ) ?> |
| 78 |
|
| 79 |
<?php endforeach; ?> |
| 80 |
</div> <!-- wpfl-1 --> |
| 81 |
|