Пример #1
0
function tst_related_posts_list($cpost = null, $tax = 'post_tag', $limit = 5, $args = array())
{
    global $post;
    if (empty($cpost)) {
        $cpost = $post;
    }
    $defaults = array('thumb' => true, 'meta' => true, 'thumb_size' => 'post-thumbnail', 'not_found_msg' => true);
    $args = wp_parse_args($args, $defaults);
    $r_ids = tst_get_related_ids($cpost, $tax, $limit);
    if (empty($r_ids) && $args['not_found_msg']) {
        ?>
		<p><?php 
        _e('No related posts found.', 'tst');
        ?>
</p>
	<?php 
        return;
    }
    $query = new WP_Query(array('post__in' => $r_ids, 'post_type' => 'any'));
    if ($query->have_posts()) {
        ?>
	<ul class="related-posts">
	<?php 
        while ($query->have_posts()) {
            $query->the_post();
            ?>
	<li class="tst-recent-item <?php 
            echo esc_attr($post->post_type);
            if ($args['thumb']) {
                echo ' has-thumb';
            }
            ?>
">

		<?php 
            if (has_post_thumbnail() && $args['thumb'] == true) {
                //thumb
                ?>
			<div class="item-preview"><a href="<?php 
                the_permalink();
                ?>
" rel="bookmark" >
				<?php 
                the_post_thumbnail($args['thumb_size']);
                ?>
			</a></div>
		<?php 
            }
            ?>

			<div class="item-title"><a href="<?php 
            the_permalink();
            ?>
" rel="bookmark"><?php 
            the_title();
            ?>
</a></div>			
			
			<?php 
            //metas
            if ($args['meta']) {
                $meta = tst_related_item_meta($post);
                $sep = frl_get_sep();
                if (!empty($meta)) {
                    ?>
			<div class="item-metadata"><?php 
                    echo implode($sep, $meta);
                    ?>
</div>
			<?php 
                }
            }
            ?>
	</li>
	<?php 
        }
        wp_reset_postdata();
        ?>
	</ul>
<?php 
    } elseif ($args['not_found_msg']) {
        ?>
	<p><?php 
        _e('No related posts found.', 'tst');
        ?>
</p>
<?php 
    }
}
Пример #2
0
    /**
     * Prints HTML with meta information for the current post-date/time and author.
     */
    function tst_posted_on()
    {
        $pt = get_post_type();
        if ('event' == $pt) {
            tst_event_undertitle_meta();
            return;
        } else {
            $cat = get_the_term_list(get_the_ID(), 'category', '<span class="category">', ', ', '</span>');
        }
        $sep = frl_get_sep();
        if (!empty($cat)) {
            $cat = ' ' . $sep . ' ' . $cat;
        }
        ?>
	
	<time class="entry-date" datetime="<?php 
        echo esc_attr(get_the_date('c'));
        ?>
"><?php 
        echo esc_html(get_the_date());
        ?>
</time>
	<?php 
        echo $cat;
    }
Пример #3
0
function tst_member_fixed_meta($member = null)
{
    global $tst_member;
    if (!$member) {
        $member = $tst_member;
    }
    ?>
<span class="fixed-member-meta">
<span class="status-meta" title="<?php 
    _e('Location', 'tst');
    ?>
">
<?php 
    echo sanitize_text_field(tst_get_member_field('user_city', $member));
    ?>
</span>
<?php 
    echo frl_get_sep();
    ?>
<span class="time-label"><?php 
    _e('Joined at', 'tst');
    ?>
: </span>
<time><?php 
    echo tst_get_member_field('user_date', $member);
    ?>
 </time>
</span>
<?php 
}