function news_by_cat($args, $content) { if (!is_null($args['cat_id'])) { if (!is_null($args['take_num'])) { query_posts('cat=' . $args['cat_id'] . '&showposts=' . $args['take_num']); } else { query_posts('cat=' . $args['cat_id']); } if (have_posts()) { echo "<div class='news_content'><h3>" . get_cat_name($args['cat_id']) . "</h3>"; echo "<hr/>"; while (have_posts()) { the_post(); ?> <div class="news-item"> <h2 class="h2 entry-title"><a href="<?php the_permalink(); ?> "><span class="entry-title-text"><?php the_title(); ?> </span></a></h2> <div class="posted-on"><span class="posted-on-string"><?php printf(__('Ngày đăng: %1$s', 'cswd'), get_the_date() . " " . get_the_time()); ?> </span></div> <?php cswd_thumbnail('thumbnail'); ?> <div class="entry-content clearfix"> <?php the_excerpt(); ?> </div> </div> <?php } echo "</div>"; } } }
function top_news() { query_posts('cat=11,12,13&showposts=5'); if (have_posts()) { echo "<div class='news_content'><div class='alert news-alert alert-primary'><h2 class='news_title'>Tin tức mới</h2></div>"; echo "<hr/>"; while (have_posts()) { the_post(); ?> <div class="news-item"> <h2 class="h2 entry-title"><a href="<?php the_permalink(); ?> "><span class="entry-title-text"><?php the_title(); ?> </span></a></h2> <div class="posted-on"><span class="posted-on-string"><?php printf(__('Ngày đăng: %1$s', 'cswd'), get_the_date() . " " . get_the_time() . " Lượt xem: " . getPostViews(get_the_ID())); ?> </span></div> <?php cswd_thumbnail('thumbnail'); ?> <div class="entry-content clearfix"> <?php the_excerpt(); ?> </div> </div> <?php } echo "</div>"; } }
<article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <header class="entry-header"> <?php cswd_thumbnail('large'); ?> <?php cswd_entry_header(); ?> <?php /* * Đếm số lượng attachment có trong post */ $attachments = get_children(array('post_parent' => $post->ID)); $attachment_number = count($attachments); printf(__('This image post contains %1$s photos', 'cswd'), $attachment_number); ?> </header> <div class="entry-content"> <?php cswd_entry_content(); ?> <?php is_single() ? cswd_entry_tag() : ''; ?> </div>
function news_by_cat($args, $content) { if (!is_null($args['cat_id'])) { if (!is_null($args['take_num'])) { query_posts('cat=' . $args['cat_id'] . '&showposts=' . $args['take_num']); } else { query_posts('cat=' . $args['cat_id']); } if (have_posts()) { echo "<div class='news_content'><div class='alert news-alert alert-primary'><h2 class='news_title'>" . $args['cat_title'] . "</h2></div>"; echo "<hr/>"; while (have_posts()) { the_post(); ?> <div class="news-item"> <h2 class="h2 entry-title"><a href="<?php the_permalink(); ?> "><span class="entry-title-text"><?php the_title(); ?> </span></a></h2> <div class="posted-on"><span class="posted-on-string"><?php printf(__('Published on: %1$s', 'cswd'), get_the_date() . " " . get_the_time() . " Lượt xem: " . getPostViews(get_the_ID())); ?> </span></div> <?php cswd_thumbnail('thumbnail'); ?> <div class="entry-content clearfix"> <?php the_excerpt(); ?> </div> </div> <?php } echo "</div>"; } } }
<article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <div class="entry-thumbnail"> <?php cswd_thumbnail('thumbnail'); ?> </div> <header class="entry-header"> <?php /* * Lưu custom field vào biến */ $link = get_post_meta($post->ID, 'format_link_url', true); $link_description = get_post_meta($post->ID, 'format_link_description', true); /* * Hiển thị tiêu đề có link trỏ tới link gắn trong custom field */ if (is_single()) { printf('<h1 class="entry-title"><a href="%1$s" target="blank">%2$s</a></h1>', $link, get_the_title()); } else { printf('<h2 class="entry-title"><a href="%1$s" target="blank">%2$s</a></h2>', $link, get_the_title()); } ?> </header> <div class="entry-content"> <?php