| 1 |
<?php |
| 2 |
// Exit if accessed directly |
| 3 |
if( ! defined( 'ABSPATH' ) ) exit; |
| 4 |
?> |
| 5 |
|
| 6 |
<div class="wpfl-1"> |
| 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' ); |
| 25 |
if( $intro_posts < 1 ) { |
| 26 |
$intro_posts = null; |
| 27 |
} else { |
| 28 |
$intro_posts = ( $intro_posts > 1 ) ? ( $intro_posts - 1 ) : $intro_posts = 0; |
| 29 |
} |
| 30 |
$first_poster = wpforo_member( $first_post ); |
| 31 |
$posts = WPF()->post->get_posts( [ 'topicid' => $topic['topicid'], 'exclude' => $topic['first_postid'], 'orderby' => '`is_first_post` ASC, `created` DESC, `postid` DESC', 'row_count' => $intro_posts ] ); |
| 32 |
$posts = array_reverse( $posts ); |
| 33 |
} |
| 34 |
$topic_url = wpforo_topic( $topic['topicid'], 'url' ); |
| 35 |
$post_toglle = wpforo_setting( 'topics', 'layout_extended_intro_posts_toggle' ); |
| 36 |
?> |
| 37 |
|
| 38 |
<div class="topic-wrap <?php wpforo_unread( $topic['topicid'], 'topic' ); ?>"> |
| 39 |
<div class="wpforo-topic"> |
| 40 |
<div class="wpforo-topic-icon"> |
| 41 |
<?php wpforo_topic_icon( $topic, 'base' ); ?> |
| 42 |
</div> |
| 43 |
<div class="wpforo-topic-info"> |
| 44 |
<p class="wpforo-topic-title"><?php wpforo_topic_title( $topic, $topic_url, '{is}{p}{au}{t}{/a}{n}{v}' ) ?></p> |
| 45 |
<p class="wpforo-topic-start-info wpfcl-1"> |
| 46 |
<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> |
| 47 |
<?php if( isset( $last_post ) && ! empty( $last_post ) ) : ?> |
| 48 |
<span class="wpf-vsep">|</span> |
| 49 |
<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> |
| 50 |
<?php endif; ?> |
| 51 |
</p> |
| 52 |
<div class="wpforo-topic-badges"><?php do_action( 'wpforo_topic_info_end', $topic ); ?></div> |
| 53 |
</div> |
| 54 |
<div class="wpforo-topic-stat-views"><?php echo intval( $topic['views'] ) ?></div> |
| 55 |
<div class="wpforo-topic-stat-posts"><?php echo intval( $topic['posts'] ) ?></div> |
| 56 |
<br class="wpf-clear"> |
| 57 |
</div><!-- wpforo-topic --> |
| 58 |
<div class="wpforo-last-posts-<?php echo intval( $topic['topicid'] ) ?>" style="display: <?php echo( $post_toglle == 1 ? 'block' : 'none' ); ?>"> |
| 59 |
<div class="wpforo-last-posts-tab"> </div> |
| 60 |
<div class="wpforo-last-posts-list"> |
| 61 |
<ul> |
| 62 |
<li> |
| 63 |
<div class="wpforo-last-post-title"><i class="fas fa-comments fa-flip-horizontal 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> |
| 64 |
<div class="wpforo-last-post-user"><?php wpforo_member_link( $first_poster, 'by %s', 9 ); ?></div> |
| 65 |
<div class="wpforo-last-post-date"><?php wpforo_date( $first_post['created'] ); ?></div> |
| 66 |
<br class="wpf-clear"> |
| 67 |
</li> |
| 68 |
<?php if( ! empty( $posts ) && is_array( $posts ) ) : ?> |
| 69 |
<?php foreach( $posts as $post ) : ?> |
| 70 |
<?php $poster = wpforo_member( $post ); ?> |
| 71 |
<li> |
| 72 |
<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( |
| 73 |
$post['title'] |
| 74 |
) ) ?></a></div> |
| 75 |
<div class="wpforo-last-post-user"><?php wpforo_member_link( $poster, 'by %s', 9 ); ?></div> |
| 76 |
<div class="wpforo-last-post-date"><?php wpforo_date( $post['created'] ); ?></div> |
| 77 |
<br class="wpf-clear"> |
| 78 |
</li> |
| 79 |
<?php endforeach ?> |
| 80 |
<?php if( intval( $topic['posts'] ) > ( $intro_posts + 1 ) ): ?> |
| 81 |
<li style="text-align:right;"><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> |
| 82 |
<?php endif ?> |
| 83 |
<?php endif ?> |
| 84 |
</ul> |
| 85 |
</div><!-- wpforo-last-posts-list --> |
| 86 |
<br class="wpf-clear"> |
| 87 |
</div><!-- wpforo-last-posts --> |
| 88 |
</div> |
| 89 |
|
| 90 |
<?php do_action( 'wpforo_loop_hook', $key ) ?> |
| 91 |
|
| 92 |
<?php endforeach; ?> |
| 93 |
</div> <!-- wpfl-1 --> |
| 94 |
|