/** * [mo_minicat description] * @return html [description] */ function mo_minicat() { if (!_hui('minicat')) { return; } $args = array('ignore_sticky_posts' => 1, 'showposts' => 1, 'cat' => _hui('minicat')); query_posts($args); while (have_posts()) { the_post(); $category = get_the_category(); echo '<article class="excerpt-minic excerpt-minic-index">'; echo '<h2><a' . _post_target_blank() . ' class="red" href="' . get_category_link($category[0]->term_id) . '">【' . (_hui('minicat_home_title') ? _hui('minicat_home_title') : '今日观点') . '】</a> <a href="' . get_permalink() . '" title="' . get_the_title() . _get_delimiter() . get_bloginfo('name') . '">' . get_the_title() . '</a></h2>'; echo '<p class="note">' . _get_excerpt() . '</p>'; echo '</article>'; } wp_reset_query(); }
echo '<a class="cat" href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '<i></i></a> '; } } echo '<h2><a' . _post_target_blank() . ' href="' . get_permalink() . '" title="' . get_the_title() . _get_delimiter() . get_bloginfo('name') . '">' . get_the_title() . '</a></h2>'; echo '</header>'; echo '<p class="meta">'; if ($p_meta && $p_meta['date']) { echo '<time><i class="fa fa-clock-o"></i>' . get_the_time('Y-m-d') . '</time>'; } if ($p_meta && $p_meta['author']) { $author = get_the_author(); if (_hui('author_link')) { $author = '<a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . $author . '</a>'; } echo '<span class="author"><i class="fa fa-user"></i>' . $author . '</span>'; } if ($p_meta && $p_meta['view']) { echo '<span class="pv"><i class="fa fa-eye"></i>' . _get_post_views() . '</span>'; } if (comments_open() && $p_meta && $p_meta['comm']) { echo '<a class="pc" href="' . get_comments_link() . '"><i class="fa fa-comments-o"></i>评论(' . get_comments_number('0', '1', '%') . ')</a>'; } echo '</p>'; echo '<p class="note">' . _get_excerpt() . '</p>'; if (_hui('post_link_excerpt_s')) { _moloader('mo_post_link'); } echo '</article>'; } _moloader('mo_paging'); wp_reset_query();
function u_post_data() { $items = array(); while (have_posts()) { the_post(); $cat = ''; if (!is_category()) { $category = get_the_category(); if ($category[0]) { $cat = $category[0]->cat_name; } } $items[] = array('thumb' => u_get_thumbnail_src(), 'link' => get_permalink(), 'title' => get_the_title(), 'desc' => _get_excerpt(), 'time' => get_the_time('Y-m-d G:i'), 'cat' => $cat, 'view' => u_get_views(), 'comment' => (int) get_comments_number('0', '1', '%'), 'like' => u_get_post_like_number()); } wp_reset_query(); return $items; }