Example #1
0
function lion_post_list($type = 'latest', $num = 5)
{
    if ($type == 'popular') {
        $the_query = new WP_Query(array('posts_per_page' => $num, 'orderby' => 'meta_value_num', 'meta_key' => '_post_like'));
    } elseif ($type == 'modified') {
        $the_query = new WP_Query(array('posts_per_page' => $num, 'orderby' => 'modified'));
    } else {
        $the_query = new WP_Query(array('posts_per_page' => $num, 'orderby' => 'latest'));
    }
    $post_list = '';
    while ($the_query->have_posts()) {
        $the_query->the_post();
        $post_list .= '<li class="list-item u-clearfix"><a href="' . get_permalink() . '" title="' . get_the_title() . '"><div class="list-item-image';
        if (!lion_is_has_image()) {
            $post_list .= ' no-image';
        }
        $post_list .= ' u-floatLeft" style="background-image:url(' . get_post_thumbnail() . ')"></div><div class="list-item-title">' . get_the_title() . '</div><div class="list-item-meta">' . get_the_date('Y-m-d');
        if (function_exists('wpl_get_like_count')) {
            $post_list .= '<span class="middotDivider"></span>' . wpl_get_like_count() . ' likes';
        }
        $post_list .= '</div></a></li>';
    }
    wp_reset_postdata();
    return $post_list;
}
Example #2
0
        <h2 class="block-title" itemprop="headline">
            <a href="<?php 
the_permalink();
?>
" title="<?php 
the_title();
?>
" rel="bookmark"><?php 
the_title();
?>
</a>
        </h2>
    </header>
    <div class="block-content u-clearfix grap">
        <?php 
if (lion_is_has_image()) {
    ?>
            <div class="block-image" style="background-image:url(<?php 
    echo get_post_thumbnail();
    ?>
)">
            </div>
        <?php 
}
?>
        <?php 
echo mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 280, "……");
?>
    </div>
    <footer class="block-footer u-clearfix">
        <?php