<?php
/**
 * Template part for displaying moments
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package pix
 */
$author_id = get_the_author_meta( 'ID' ); 
$url = get_author_posts_url($author_id);
$avatar = get_u_avatar($author_id,$type = 'url');
$type = !empty($args) ? $args['type'] : false;
$badges = function_exists('ppo_user_badges_html') ? ppo_user_badges_html($author_id, 'moment') : '';
?>

<div id="post-<?php the_ID(); ?>" <?php post_class('post-item moment_item uk-animation-slide-bottom-small single-detail'); ?>>
    <div class="moment-single-inner">

        <div class="moment-avatar">           
                <a href="<?php echo $url; ?>" target="_blank">
                    <img class="mo-ava lazy" data-src="<?php echo $avatar; ?>" alt="" uk-img="loading: lazy">
                </a>
        </div><!-- .entry-header -->

        <div class="moment-content-right">
            <div class="mo-meta">
                <div lcass="left">
                    <div class="nickname"><a href="<?php echo $url; ?>" target="_blank"><?php the_author(); ?></a><?php echo $badges; ?></div>
                    <div class="lv-info"></div>
                </div>
                <div class="right">
                <?php if(is_sticky()){ ?>
                        <span class="sticky_m_icon"><i class="ri-upload-line"></i>置顶</span>
                    <?php } else {
                        echo get_moment_first_cat($post->ID);
                    } ?>
                    
                </div>
            </div>

            <div class="mosub-meta">
                <time class="timeago" itemprop="datePublished" datetime="<?php echo get_the_date('c');?>"><?php echo ''.get_gmt_from_date(get_the_time('Y-m-d G:i:s')); ?></time>
            </div>

            <div class="post-content mos-content">
                <div class="momoent_title single"><?php the_title(); ?></div>
                <div class="ppo-rich-text">
                <div class="ppo-rich-text-content">
                    <p><?php echo ppo_moment_filter(); ?></p>
                </div>
            </div>
                <?php echo get_moment_type_content(); ?>
                <?php echo get_moment_tag_link($post->ID); ?>
            </div>

            
        </div><!-- .entry-content -->

    </div>

        <div class="moment-footer">
                <div class="left">
                    <div class="post-like item"><?php echo post_like_btn($post->ID); ?></div>
                    <div class="post-collect item"><?php echo post_collect_btn($post->ID); ?></div>
                    <div class="moment-share item"><a class="moment-share-btn"><i class="ri-share-forward-box-line"></i></a></div>
                    <?php echo mo_edit_btn($post->ID); ?>
                </div>
                <div class="right">
                    <?php if(is_moment_hot($post->ID)){ ?>
                        <span class="hot_m_icon"><i class="ri-vip-diamond-line"></i>精华</span>
                    <?php } ?>
                </div>
            </div><!-- .entry-footer -->

    <div class="moment_comments_wrap t_com_<?php echo $post->ID; ?>" style="display:none">
				<?php
					global $withcomments;
					$withcomments = true;
					comments_template('inc/layouts/comment-tmp.php'); 				
				?>
			</div>

</div><!-- #post-<?php the_ID(); ?> -->
