function get_page_list() { $cat = $_GET['cat']; $page = $_GET['page']; $posts_per_page = $_GET['posts_per_page']; if (!is_null($cat) && $cat != 0 && !is_null($page)) { $args = array("category__in" => array($cat), "paged" => $page, "posts_per_page" => $posts_per_page, "post_status" => "publish", 'post_type' => 'post', 'orderby' => 'post_date', 'order' => 'desc'); } else { if (!is_null($cat) && $cat != 0 && is_null($page)) { $args = array("category__in" => array($cat), "posts_per_page" => $posts_per_page, "post_status" => "publish", 'post_type' => 'post', 'orderby' => 'post_date', 'order' => 'desc'); } else { if ((is_null($cat) || $cat == 0) && !is_null($page)) { $args = array("paged" => $page, "posts_per_page" => $posts_per_page, "post_status" => "publish", 'post_type' => 'post', 'orderby' => 'post_date', 'order' => 'desc'); } else { $args = array("posts_per_page" => $posts_per_page, "post_status" => "publish", 'post_type' => 'post', 'orderby' => 'post_date', 'order' => 'desc'); } } } if (!is_null($cat)) { $posts = get_posts('post_status=publish&numberposts=-1&category=' . $cat); $count_total = count($posts); } else { $cat_case = get_category_by_slug('case'); $cat_interview = get_category_by_slug('interview'); $cat_personnel = get_category_by_slug('personnel'); $cat_special = get_category_by_slug('special-column'); $cat_news = get_category_by_slug('news'); $posts = get_posts('post_status=publish&numberposts=-1&category=' . $cat_case . ',' . $cat_interview . ',' . $cat_personnel . ',' . $cat_special . ',' . $cat_news); $count_total = count($posts); } $the_query = new WP_Query($args); $resultData = new resultData(); $resultList = array(); $resultData->count_total = $count_total; while ($the_query->have_posts()) { $the_query->the_post(); $post = new postData(); $post->title_plain = get_the_title(); $post->url = get_permalink(); $post->thumbnail = get_template_directory_uri() . "/timthumb.php?src=" . post_thumbnail_src() . "&h=168&w=224&zc=1"; $post->excerpt = get_the_excerpt(); $post->date = get_the_date('20y-m-d'); $post->author_name = get_author_name(); $post->views = getPostViews(get_the_ID()); $the_post_category = get_the_category(get_the_ID()); $post->category_name = $the_post_category[0]->cat_name; $the_post_category = get_the_category(get_the_ID()); $catSlug = $the_post_category[0]->slug; $post->category_slug = $catSlug; $resultList[] = $post; } $resultData->posts = $resultList; header("Content-type: application/json"); echo json_encode($resultData); wp_reset_query(); die; }
function dtheme_posts_list($orderby, $limit, $cat, $img) { $args = array('order' => DESC, 'cat' => $cat, 'orderby' => $orderby, 'showposts' => $limit, 'caller_get_posts' => 1); query_posts($args); while (have_posts()) { the_post(); ?> <li> <a target="_blank" href="<?php the_permalink(); ?> " title="<?php the_title(); ?> " ><?php if (git_get_option('git_cdnurl_b')) { if ($img) { echo '<span class="thumbnail">'; echo '<img src="'; echo post_thumbnail_src(); echo '?imageView2/1/w/100/h/64/q/85" alt="' . get_the_title() . '" /></span>'; } else { $img = ''; } } else { if ($img) { echo '<span class="thumbnail">'; echo '<img src="' . get_bloginfo("template_url") . '/timthumb.php?src='; echo post_thumbnail_src(); echo '&h=64&w=100&q=90&zc=1&ct=1" alt="' . get_the_title() . '" /></span>'; } else { $img = ''; } } ?> <span class="text"><?php the_title(); ?> </span><span class="muted"><?php the_time('Y-m-d'); ?> </span><span class="muted"><?php comments_number('0', '1评论', '%评论'); ?> </span></a> </li> <?php } wp_reset_query(); }
<?php if ($index == 1) { ?> <div title="<?php the_permalink(); ?> " class="f-l list-small-news"> <h2><?php the_title_attribute(); ?> </h2> <img src="<?php echo get_template_directory_uri(); ?> /timthumb.php?src=<?php echo post_thumbnail_src(); ?> &h=264&w=464&zc=1" width="464" height="264" alt="<?php the_title_attribute(); ?> "> </div> <?php } ?> <?php $index++; } wp_reset_query(); ?>
function dtheme_posts_list($limit, $cat) { $args = array('order' => DESC, 'cat' => $cat, 'orderby' => rand, 'showposts' => $limit, 'post_status' => 'publish', 'caller_get_posts' => 1); query_posts($args); while (have_posts()) { the_post(); ?> <li> <a rel="nofollow" class="post_thumbnail" href="<?php the_permalink(); ?> "> <img src="<?php echo get_template_directory_uri(); ?> /timthumb.php?src=<?php echo post_thumbnail_src(); ?> &h=60&w=80&zc=1" width="80" height="60" alt="<?php the_title(); ?> " /> </a> <a class="post_title" href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_title(); ?> </a> </li> <?php } wp_reset_query(); }
<div class="col-md-3 gallery-grid "> <?php if (has_post_thumbnail()) { ?> <a href="<?php the_permalink(''); ?> " title="<?php the_title(); setPostViews(get_the_ID()); ?> "> <img src="<?php post_thumbnail_src(255, 269); ?> " width="255" height="269" alt=" <?php the_title(); ?> " class="img-responsive" /></a> <?php } else { ?> <a href="<?php the_permalink(''); ?> " title="<?php the_title();
/** * wwh_home_page_article 首页文章 * * @param mixed $cat_id 分类ID * @param string $location 位置 * @param string $art_name 一级标题 * @param string $em 二级标题 * @access public * @return void */ function wwh_home_page_article($cat_id, $location = 'top', $art_name = '文章', $em = '文章') { $args = array('cat' => $cat_id, 'posts_per_page' => 3, 'ignore_sticky_posts' => 1); $str = '<article class="article article-' . $location . ' container container-margin">'; $str .= '<h2>' . $art_name . '</h2><span>' . $em . '</span>'; $str .= '<div class="row">'; query_posts($args); while (have_posts()) { the_post(); $str .= '<div class="col-md-4">'; $str .= '<a href="' . get_the_permalink() . '">'; $str .= '<img src="' . post_thumbnail_src() . '" alt="' . wwh_the_title() . '" width="293px" height="195px" />'; $str .= '</a>'; $str .= '<a href="' . get_the_permalink() . '"><h4>' . wwh_the_title() . '</h4></a>'; $str .= '<p class="publish-time">'; $str .= '<span class="glyphicon glyphicon-time" aria-hidden="true"></span>'; $str .= '' . get_the_time('Y-m-d') . ''; $str .= '</p>'; $str .= '<div class="post-content" id="clampjs">'; $str .= strip_tags(get_the_content()); $str .= '</div>'; $str .= '<a class="btn view-more" href="' . get_the_permalink() . '">查看更多</a>'; $str .= '</div>'; } $str .= '</div>'; $str .= '</article>'; return $str; }
<?php if (have_posts()) { while (have_posts()) { the_post(); ?> <div class="col-md-3 gallery-grid "> <?php if (has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?> "> <img src="<?php post_thumbnail_src(635, 278); ?> " width="635" height="278" alt=" <?php the_title(); ?> " class="img-responsive" /></a> <?php } else { ?> <a href="<?php the_permalink(); ?> "> <img src="<?php
} else { ?> <div class="col-md-4 gallery-grid glry-two"> <a href="<?php the_permalink(''); ?> " title="<?php the_title(); setPostViews(get_the_ID()); ?> "> <?php if (has_post_thumbnail()) { ?> <img src="<?php post_thumbnail_src(350, 419); ?> " width="350" height="419" alt=" <?php the_title(); ?> " class="img-responsive" /></a> <?php } else { ?> <a href="<?php the_permalink(''); ?> " title="<?php the_title();
$_thumbnail = false; if( has_post_thumbnail() || !dopt('d_thumbnail_b') ){ $_thumbnail = true; } ?> <article class="excerpt<?php echo !$_thumbnail ? ' excerpt-nothumbnail' : '' ?>"> <header><?php if( !is_category() ) {$category = get_the_category(); if($category[0]){echo '<a class="label label-important" href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'<i class="label-arrow"></i></a>';} };?><h2><a target="_blank" href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?> <?php $t1=$post->post_date; $t2=date("Y-m-d H:i:s"); $diff=(strtotime($t2)-strtotime($t1))/3600; if($diff<12){echo '<img src="'.get_bloginfo("template_url").'/img/new.gif" alt="24小时内最新">';}?> </a></h2> </header> <?php if( $_thumbnail ){ ?> <div class="focus"><a target="_blank" href="<?php the_permalink(); ?>"><img class="thumb" src="<?php $url = post_thumbnail_src();if(strpos($url, $_SERVER['SERVER_NAME'])){ echo get_bloginfo('template_url') .'/timthumb.php?src='.$url.'&h=123&w=200&q=90&zc=1&ct=1';}else{echo $url.'?imageMogr2/thumbnail/200x123!';} ?>" alt="<?php the_title(); ?>" /></a></div> <?php } ?> <span class="note"> <?php echo deel_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 140, '...'); ?></span> <p class="auth-span"> <?php if( !is_author() && !$_author ){ ?> <span class="muted"><i class="fa fa-user"></i> <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ) ?>"><?php echo get_the_author() ?></a></span> <?php } ?> <?php if( !$_time ){ ?><span class="muted"><i class="fa fa-clock-o"></i> <?php echo timeago( get_gmt_from_date(get_the_time('Y-m-d G:i:s')) ) ?></span><?php } ?> <?php if( !$_views ){ ?><span class="muted"><i class="fa fa-eye"></i> <?php deel_views('℃'); ?></span><?php } ?> <?php if( !$_comment ){ ?><span class="muted"><i class="fa fa-comments-o"></i> <?php if ( comments_open() ) echo '<a target="_blank" href="'.get_comments_link().'">'.get_comments_number('0', '1', '%').'评论</a>' ?></span><?php } ?> <?php if( !$_like ){ ?><span class="muted"> <a href="javascript:;" data-action="ding" data-id="<?php the_ID(); ?>" id="Addlike" class="action<?php if(isset($_COOKIE['bigfa_ding_'.$post->ID])) echo ' actived';?>"><i class="fa fa-heart-o"></i><span class="count"><?php if( get_post_meta($post->ID,'bigfa_ding',true) ){ echo get_post_meta($post->ID,'bigfa_ding',true); } else {echo '0';}?></span>喜欢</a></span><?php } ?></p> </article> <?php endwhile; wp_reset_query(); ?>