示例#1
0
function sith_popular_posts($pop_posts = 5, $thumb = true)
{
    global $post;
    $orig_post = $post;
    $popularposts = new WP_Query(array('orderby' => 'comment_count', 'order' => 'DESC', 'posts_per_page' => $pop_posts, 'post_status' => 'publish', 'no_found_rows' => 1, 'ignore_sticky_posts' => 1));
    while ($popularposts->have_posts()) {
        $popularposts->the_post();
        ?>
<li <?php 
        sith_post_class();
        ?>
>
  <?php 
        if (function_exists("has_post_thumbnail") && has_post_thumbnail() && $thumb) {
            ?>
  <div class="post-thumbnail"><a href="<?php 
            echo get_permalink($post->ID);
            ?>
" title="<?php 
            printf(__('%s', 'sith'), the_title_attribute('echo=0'));
            ?>
" rel="bookmark">
    <?php 
            sith_thumb();
            ?>
    </a></div>
  <!-- post-thumbnail /-->
  <?php 
        }
        ?>
  <h3><a href="<?php 
        echo get_permalink($post->ID);
        ?>
" title="<?php 
        echo the_title();
        ?>
"><?php 
        echo the_title();
        ?>
</a></h3>
  <span class="date"><?php 
        echo get_the_time(get_option('date_format'));
        ?>
</span></li>
<?php 
    }
    $post = $orig_post;
}
示例#2
0
<div class="box-w-caption box-w-caption2">
  <div class="post-2caption post-default-loop-caption">
    <article <?php 
sith_post_class('post-loop-caption');
?>
>
      <div> <a href="<?php 
the_permalink();
?>
" title="<?php 
printf(esc_attr__('%s', 'sith'), the_title_attribute('echo=0'));
?>
" rel="bookmark">
        <?php 
sith_thumb($size2c);
?>
        </a> </div>
      <?php 
if (has_post_thumbnail()) {
} else {
    echo ' <div><a href="' . ($permalink = get_permalink($id) . '" title="" rel="bookmark"><img src="' . get_bloginfo('template_directory') . '/images/default-thumbnail-img.png"/></a></div>');
}
?>
      <div class="post-caption">
        <h2><a href="<?php 
the_permalink();
?>
" title="<?php 
printf(esc_attr__('%s', 'sith'), the_title_attribute('echo=0'));
?>
示例#3
0
    } elseif ($get_meta['sith_post_head'][0] == 'lightbox' && has_post_thumbnail($post->ID)) {
        $image_id = get_post_thumbnail_id($post->ID);
        $image_url = wp_get_attachment_image_src($image_id, 'large');
        $image_url = $image_url[0];
        if ($get_meta["sith_sidebar_pos"][0] == 'full') {
            $size = 'big-slider';
        } else {
            $size = 'slider';
        }
        ?>
		<div class="single-post-thumb head-lightbox">
			<a href="<?php 
        echo $image_url;
        ?>
" rel="prettyPhoto"><?php 
        sith_thumb($size);
        ?>
</a>
		</div>
		<?php 
        $thumb_caption = get_post(get_post_thumbnail_id())->post_excerpt;
        if (!empty($thumb_caption)) {
            ?>
<div class="single-post-caption"><?php 
            echo $thumb_caption;
            ?>
</div> <?php 
        }
        ?>
			
<?php